/* Combined Stylesheet for Student Hub */
/* Merges variation-4-enhanced.css (for Design 4.1) and variation-3-custom.css (for Design 3) */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300;400;500;600;700&family=Quicksand:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  /* Brand Colors */
  --dark-green: #0F3C26;
  --medium-green: #2D6B3C;
  --light-green: #5B8F55;
  --bright-green: #4a9b5c;
  --cream: #ECE7DF;
  --light-cream: #FFF8E7;
  --white: #FFFFFF;

  /* Accent Colors */
  --accent-orange: #FF8C42;
  --accent-blue: #5BC0EB;
  --accent-purple: #8B5CF6;
  --accent-pink: #EC4899;

  /* Typography */
  --font-bubbly: 'Fredoka', sans-serif;
  --font-clean: 'Quicksand', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing Scale */
  --hub-space-xs: 8px;
  --hub-space-sm: 12px;
  --hub-space-md: 20px;
  --hub-space-lg: 30px;
  --hub-space-xl: 50px;

  /* Container */
  --hub-container: 1200px;
  --hub-padding: clamp(1rem, 3vw, 2rem);

  /* Category Colors - Muted earth tones */
  --art-primary: #c86748;
  --art-bg: linear-gradient(135deg, #faf6f3 0%, #f5ede7 100%);

  --science-primary: #4a7c8c;
  --science-bg: linear-gradient(135deg, #f4f8f7 0%, #e8f2f0 100%);

  --coding-primary: #6b5b7c;
  --coding-bg: linear-gradient(135deg, #f7f6f9 0%, #f0edf3 100%);

  --games-primary: #a6546d;
  --games-bg: linear-gradient(135deg, #f9f5f6 0%, #f3e9ec 100%);

  --stories-primary: #b8884a;
  --stories-bg: linear-gradient(135deg, #faf8f3 0%, #f5f0e7 100%);

  --design-primary: #7c6b4a;
  --design-bg: linear-gradient(135deg, #f7f5f2 0%, #eeebe5 100%);
}

body {
  font-family: var(--font-body);
  background: linear-gradient(135deg, #f5f3ed 0%, #fff 100%);
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* === CLEAN HEADER (from V4) === */
.activity-header-v4 {
  background: linear-gradient(135deg, var(--dark-green) 0%, var(--medium-green) 100%);
  padding: 1.5rem 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
}

.activity-header-v4::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 50%;
  height: 200%;
  background: var(--light-green);
  opacity: 0.2;
  transform: rotate(45deg);
}

.header-content-v4 {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--hub-padding);
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left-v4 {
  display: flex;
}

.logo-text-v4 {
  font-family: var(--font-bubbly);
  font-size: 2rem;
  font-weight: 600;
  color: white;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.hub-title-v4 {
  font-family: var(--font-clean);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--cream);
  opacity: 0.95;
}

.surprise-btn-v4 {
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-pink));
  color: white;
  border: none;
  padding: 0.75rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-clean);
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(255, 140, 66, 0.3);
  position: relative;
  overflow: hidden;
}

.surprise-btn-v4::before {
  content: '✨';
  position: absolute;
  left: -30px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  opacity: 0;
  transition: all 0.3s ease;
}

.surprise-btn-v4:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 140, 66, 0.4);
}

.surprise-btn-v4:hover::before {
  left: 15px;
  opacity: 1;
}

/* === MAIN CONTAINER === */
.main-container-v4,
.category-spotlight-v4,
.library-section-v3 {
  max-width: var(--hub-container);
  padding: 0 var(--hub-padding);
  margin-left: auto;
  margin-right: auto;
}

.main-container-v4 {
  margin-top: 3rem;
}

/* === FEATURED GAME SECTION (from V4) === */
/* Mobile-first: Start with single column */
.featured-game-v4 {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  border: 3px solid var(--bright-green);
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 4rem;
}

.game-area-v4 {
  background: #0b0b0b;
  border-radius: 12px;
  overflow: hidden;
  min-height: 350px;
  height: 60vh;
  max-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Make any iframe in the game area fill the box and stay responsive */
.game-area-v4 iframe {
  width: 100%;
  height: 100%;
  max-width: 100%;
  border: 0;
  display: block;
  touch-action: manipulation; /* Prevent double-tap zoom on mobile */
}

/* Mobile iframe optimizations */
@media (max-width: 768px) {
  .game-area-v4 iframe {
    /* Improve mobile iframe performance */
    transform: translateZ(0); /* Hardware acceleration */
    will-change: auto;
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
}

/* Mobile-specific game container optimizations */
@media (max-width: 576px) {
  .game-area-v4 {
    height: 50vh;
    min-height: 300px;
    max-height: 400px; /* Prevent overflow on very small screens */
  }

  /* Improve mobile navigation buttons */
  .nav-arrow-v4 {
    padding: 12px 20px;
    min-height: 44px; /* Apple's recommended minimum touch target */
    font-size: 16px;
  }

  .game-navigation-v4 {
    gap: 16px; /* More space between buttons on mobile */
    margin-top: 20px;
  }

  /* Mobile loading indicator */
  .mobile-loading-indicator {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .mobile-loading-indicator .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #5B8F55;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
  }

  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

  /* Reduce animation complexity on mobile */
  .mobile-optimized * {
    transition-duration: 0.2s !important;
    animation-duration: 0.2s !important;
  }

  /* Optimize library grid for mobile performance */
  .library-grid-v3 {
    max-height: 60vh; /* Smaller height on mobile to reduce DOM nodes */
  }

  .library-card-v3:hover {
    transform: none; /* Disable hover transforms on mobile to improve performance */
  }
}

@media (max-width: 480px) {
  .game-area-v4 {
    height: 45vh;
    min-height: 280px;
    max-height: 350px;
  }
}

/* Tablet portrait optimizations */
@media (min-width: 577px) and (max-width: 967px) {
  .game-area-v4 {
    height: 55vh;
    min-height: 320px;
    max-height: 450px;
  }
}

/* Desktop: Two columns */
@media (min-width: 968px) {
  .featured-game-v4 {
    /* Canvas gets the big side, info gets a narrower responsive column */
    grid-template-columns: minmax(0, 3fr) minmax(260px, 1.5fr);
    gap: 2rem;              /* was 3rem, closes the empty strip */
    padding: 2.5rem 3rem; /* slightly less vertical padding */
    align-items: stretch; /* make both columns match height */
  }

  .game-area-v4 {
    /* Square, but driven by available width instead of a fixed height */
    aspect-ratio: 1 / 1;
    width: min(100%, 680px);  /* a bit taller/wider than 660, still below the old 720 */
    height: auto;

    /* kill the constraints that caused overflow problems */
    min-height: 0;
    max-height: none;

    margin-inline: 0;         /* no centering gap */
    justify-self: start;      /* hug the left edge of the grid column */
  }

  .game-info-v4 {
    margin-left: -0.75rem; /* pull text ~12px toward the canvas */
    height: 100%;         /* flex column now exactly as tall as canvas */
  }

  .game-navigation-v4 {
    flex-direction: row;      /* keep buttons in a row on desktop */
    justify-content: center;  /* same centering as mobile */
    gap: 1rem;
    margin-top: 0;    /* important: still 0 on desktop */
  }

  .nav-arrow-v4 {
    width: auto;
  }
}

#react-game-mount-v4 {
  width: 100%;
  height: 100%;
}

.game-info-v4 {
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* top block + nav at bottom */
  gap: 1.5rem;
}

.game-badge-v4 {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--accent-orange);
  color: white;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  border-radius: 8px;
  font-weight: 600;
  font-family: var(--font-body);
  margin-bottom: 0;    /* was 1rem */
  width: fit-content;
}

.game-title-v4 {
  font-family: var(--font-bubbly);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 500;
  color: var(--dark-green);
  margin-bottom: 1rem;
  line-height: 1.2;
}

.game-description-v4 {
  font-family: var(--font-clean);
  font-size: 1.1rem;
  color: #444;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.science-questions-v4 {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  padding: 1.25rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--bright-green);
}

.question-label-v4 {
  font-family: var(--font-clean);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--medium-green);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.question-label-v4::before {
  content: '🤔';
  font-size: 1rem;
}

.question-text-v4 {
  font-family: var(--font-clean);
  font-size: 1rem;
  color: var(--dark-green);
  line-height: 1.6;
  font-weight: 500;
}

.game-controls-v4 {
  background: var(--light-cream);
  padding: 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  color: #666;
  font-family: var(--font-body);
}

.game-controls-v4 strong {
  color: var(--dark-green);
}

.game-navigation-v4 {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0;      /* let space-between handle spacing */
}

.nav-arrow-v4 {
  padding: 0.5rem 1.25rem;
  background: white;
  border: 2px solid var(--bright-green);
  color: var(--bright-green);
  border-radius: 40px;
  font-family: var(--font-clean);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-arrow-v4:hover {
  background: var(--bright-green);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 155, 92, 0.3);
}

.nav-arrow-v4:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.nav-arrow-v4:disabled:hover {
  background: white;
  color: var(--bright-green);
}

/* === CATEGORY SPOTLIGHT (from V4) === */
.category-spotlight-v4 {
  margin-bottom: var(--hub-xl);
}

.category-header {
  text-align: center;
  margin-bottom: var(--hub-space-xl);
}

.category-section-title {
  font-family: var(--font-bubbly);
  font-size: clamp(1.75rem, 5vw, 2rem);
  color: var(--dark-green);
  margin-bottom: var(--hub-space-sm);
  font-weight: 500;
}

.category-section-subtitle {
  font-family: var(--font-clean);
  font-size: 1.1rem;
  color: #666;
  font-weight: 400;
}

.category-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: var(--hub-space-lg);
}

/* Category Gateway Card Base Styles */
.category-card {
  background: white;
  border: 2px solid #e7e1cf;
  border-radius: 16px;
  padding: var(--hub-space-lg);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: inset 0 1px rgba(255,255,255,0.3), 0 2px 8px rgba(0,0,0,0.05);
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: inset 0 1px rgba(255,255,255,0.3), 0 8px 20px rgba(0,0,0,0.12);
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}


.category-card:hover::before {
  transform: scaleX(1);
}

.category-icon {
  width: 48px;
  height: 48px;
  display: block;
  margin-bottom: var(--hub-space-md);
  transition: transform 0.3s ease;
}

.category-card:hover .category-icon {
  transform: scale(1.05);
}

.category-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--hub-space-sm);
}

.category-title {
  font-family: var(--font-bubbly);
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 600;
  color: var(--dark-green);
  letter-spacing: -0.3px;
}

.category-count {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.05);
}

.category-description {
  font-family: var(--font-clean);
  font-size: 1rem;
  color: #555;
  line-height: 1.6;
  margin-bottom: var(--hub-space-md);
}

.category-preview {
  margin-bottom: var(--hub-space-md);
}

.category-preview-label {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
  margin-bottom: 8px;
}

.category-preview-list {
  font-family: var(--font-clean);
  font-size: 0.95rem;
  color: #666;
  line-height: 1.5;
}

.category-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-clean);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s;
  position: relative;
}

.category-cta::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width 0.3s ease;
}

.category-cta:hover::after {
  width: calc(100% - 24px);
}

.category-cta:hover {
  transform: translateX(4px);
}

/* Category-Specific Theme Variants */
.category-card.category-art {
  background: var(--art-bg);
  border-color: var(--art-primary);
}

.category-card.category-art::before {
  background: var(--art-primary);
}

.category-card.category-art .category-count {
  background: rgba(200, 103, 72, 0.1);
  color: var(--art-primary);
}

.category-card.category-art .category-cta {
  color: var(--art-primary);
}

.category-card.category-art .category-icon {
  color: var(--art-primary);
  stroke: var(--art-primary);
}

.category-card.category-science {
  background: var(--science-bg);
  border-color: var(--science-primary);
}

.category-card.category-science::before {
  background: var(--science-primary);
}

.category-card.category-science .category-count {
  background: rgba(74, 124, 140, 0.1);
  color: var(--science-primary);
}

.category-card.category-science .category-cta {
  color: var(--science-primary);
}

.category-card.category-science .category-icon {
  color: var(--science-primary);
  stroke: var(--science-primary);
}

.category-card.category-coding {
  background: var(--coding-bg);
  border-color: var(--coding-primary);
}

.category-card.category-coding::before {
  background: var(--coding-primary);
}

.category-card.category-coding .category-count {
  background: rgba(107, 91, 124, 0.1);
  color: var(--coding-primary);
}

.category-card.category-coding .category-cta {
  color: var(--coding-primary);
}

.category-card.category-coding .category-icon {
  color: var(--coding-primary);
  stroke: var(--coding-primary);
}

.category-card.category-games {
  background: var(--games-bg);
  border-color: var(--games-primary);
}

.category-card.category-games::before {
  background: var(--games-primary);
}

.category-card.category-games .category-count {
  background: rgba(166, 84, 109, 0.1);
  color: var(--games-primary);
}

.category-card.category-games .category-cta {
  color: var(--games-primary);
}

.category-card.category-games .category-icon {
  color: var(--games-primary);
  stroke: var(--games-primary);
}

.category-card.category-stories {
  background: var(--stories-bg);
  border-color: var(--stories-primary);
}

.category-card.category-stories::before {
  background: var(--stories-primary);
}

.category-card.category-stories .category-count {
  background: rgba(184, 136, 74, 0.1);
  color: var(--stories-primary);
}

.category-card.category-stories .category-cta {
  color: var(--stories-primary);
}

.category-card.category-stories .category-icon {
  color: var(--stories-primary);
  stroke: var(--stories-primary);
}

.category-card.category-design {
  background: var(--design-bg);
  border-color: var(--design-primary);
}

.category-card.category-design::before {
  background: var(--design-primary);
}

.category-card.category-design .category-count {
  background: rgba(124, 107, 74, 0.1);
  color: var(--design-primary);
}

.category-card.category-design .category-cta {
  color: var(--design-primary);
}

.category-card.category-design .category-icon {
  color: var(--design-primary);
  stroke: var(--design-primary);
}

/* === LIBRARY SECTION (from V3) === */
.library-section-v3 {
  margin-bottom: 60px;
}

.library-header-v3 {
  text-align: center;
  margin-bottom: var(--hub-space-lg);
}

.library-title-v3 {
  font-size: clamp(1.75rem, 5vw, 2rem);
  color: var(--dark-green);
  font-weight: 500;
  font-family: var(--font-bubbly);
  margin-bottom: 10px;
}

.library-subtitle-v3 {
  font-size: 18px;
  color: #666;
  font-family: var(--font-clean);
  font-weight: 500;
}

.library-grid-v3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: var(--hub-space-md);
  max-height: clamp(600px, 70vh, 900px);
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  padding: var(--hub-space-md);
  background: #faf8f3;
  border-radius: var(--hub-space-sm);
}

.library-grid-v3::-webkit-scrollbar {
  width: 10px;
}

.library-grid-v3::-webkit-scrollbar-track {
  background: #ECE7DF;
  border-radius: 10px;
}

.library-grid-v3::-webkit-scrollbar-thumb {
  background: #5B8F55;
  border-radius: 10px;
}

.library-grid-v3::-webkit-scrollbar-thumb:hover {
  background: #2D6B3C;
}

.library-card-v3 {
  background: white;
  border: 1px solid #e7e1cf;
  border-radius: 8px;
  padding: 20px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px rgba(255,255,255,0.3), 0 1px 4px rgba(0,0,0,0.04);
}

.library-card-v3:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 1px rgba(255,255,255,0.3), 0 4px 12px rgba(0,0,0,0.1);
}

.library-card-v3::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: #5B8F55;
  transform: translateX(-100%);
  transition: transform 0.3s;
}

.library-card-v3:hover::before {
  transform: translateX(0);
}

.library-card-v3:hover {
  border-color: #5B8F55;
  box-shadow: 0 4px 12px rgba(91, 143, 85, 0.1);
  transform: translateY(-2px);
}

.library-card-header-v3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.library-emoji-v3 {
  font-size: 32px;
}

.library-card-title-v3 {
  font-size: 18px;
  color: var(--dark-green);
  font-weight: 500;
  font-family: var(--font-bubbly);
  flex: 1;
}

.library-card-description-v3 {
  font-size: 14px;
  color: #555;
  line-height: 1.5;
  margin-bottom: 15px;
  font-family: var(--font-clean);
}

.library-card-link-v3 {
  display: inline-block;
  color: var(--medium-green);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
  font-family: var(--font-clean);
  position: relative;
}

.library-card-link-v3::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width 0.3s ease;
}

.library-card-link-v3:hover {
  color: var(--dark-green);
  transform: translateX(3px);
}

.library-card-link-v3:hover::after {
  width: calc(100% - 16px);
}

/* === FOOTER === */
.footer-v4 {
  background: var(--dark-green);
  color: white;
  padding: 3rem 2rem;
  margin-top: 4rem;
}

.footer-content-v4 {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-text-v4 {
  font-family: var(--font-clean);
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.footer-links-v4 {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.footer-link-v4 {
  color: white;
  text-decoration: none;
  font-family: var(--font-clean);
  font-size: 0.95rem;
  transition: opacity 0.3s;
}

.footer-link-v4:hover {
  opacity: 0.7;
}

.footer-copyright-v4 {
  font-family: var(--font-body);
  font-size: 0.85rem;
  opacity: 0.7;
  margin-top: 1.5rem;
}



/* Card FX overlay */
.category-card { position: relative; }
.card-layer-background {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  pointer-events: none;
  transition: background 0.3s ease;
  z-index: 0;
}
.card-layer-content {
  position: relative;
  z-index: 2;
}
.card-fx {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  pointer-events: none;
  z-index: 3;
}

/* Games score chip */
.card-score {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: var(--font-clean);
  font-weight: 700;
  background: rgba(0,0,0,0.06);
  color: var(--dark-green);
  border-radius: 12px;
  padding: 4px 10px;
  display: none;
}

/* Gravity words mode */
.gravity-word {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  font-family: var(--font-clean);
  color: var(--dark-green);
  user-select: none;
  cursor: grab;
}
.category-card.gravity-mode .card-layer-content { opacity: 0.08; }

/* Letter spans for Games card */
.letter-span { cursor: pointer; }

/* dim science card while active */
.category-card.science-dim .card-layer-background { background: rgba(0,0,0,0.15); }

/* show tiny counters under score if present */
.card-score small { font-weight: 500; margin-left: 6px; opacity: 0.8; }

/* Tool cursors */
.cursor-pickaxe { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><text x="0" y="20" font-size="20">⛏</text></svg>') 4 4, crosshair !important; }
.cursor-axe { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><text x="0" y="20" font-size="20">🪓</text></svg>') 4 4, crosshair !important; }
.cursor-bucket { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><text x="0" y="20" font-size="20">🪣</text></svg>') 4 4, crosshair !important; }
.cursor-wood { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><text x="0" y="20" font-size="20">🪵</text></svg>') 4 4, crosshair !important; }
.cursor-creative { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><text x="0" y="20" font-size="20">✨</text></svg>') 4 4, crosshair !important; }

/* Pickaxe shop badge */
.pickaxe-shop {
  position: absolute;
  right: -180px;           /* start off-canvas */
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: #2d6b3c;
  color: #fff;
  border-radius: 14px 0 0 14px;
  padding: 10px 14px;
  font-family: var(--font-clean, Inter, system-ui, sans-serif);
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
  cursor: pointer;
  z-index: 4;              /* above the canvas */
  transition: right .28s ease;
}
.pickaxe-shop.show { right: 8px; }
.pickaxe-shop .coin { width: 14px; height: 14px; border-radius: 50%; background:#D4AF37; display:inline-block; box-shadow: inset 0 0 0 2px #8C6E1A; }
.pickaxe-shop.equipped { background: #1a4023; }
.pickaxe-cursor { cursor: crosshair !important; }

/* Global locks and overlays */
.category-card.locked .card-layer-content { filter: brightness(0.4); }
.category-card .center-msg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-clean, Inter, system-ui, sans-serif); font-weight: 800; color: #fff;
  pointer-events: none;
}
.category-card .center-msg .box {
  background: rgba(0,0,0,0.6); padding: 16px 22px; border-radius: 12px; letter-spacing: 1px;
}

/* Games pause + login */
.game-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.65); color: #fff;
  display: none; z-index: 8; font-family: monospace;
}
.game-overlay.show { display: block; }
.game-overlay .big { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); font-size: 42px; }

.login-panel {
  position: absolute; inset: 0; background: #000; color: #19ff6a; display: none; z-index: 9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow: hidden;
}
.login-panel.show { display: block; }
.login-panel .scan { position: absolute; inset: 0; padding: 16px; line-height: 1.2; opacity: 0.85; }
.login-panel .center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  color: #6CFF8F; text-align: center;
}
.login-panel .cursor { display: inline-block; width: 10px; height: 1.1em; background: #6CFF8F; vertical-align: -0.2em; animation: blink .8s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Ability toolbar */
.ability-bar {
  position: absolute; top: 8px; right: 8px; z-index: 7; display: none; gap: 6px;
}
.ability-bar.show { display: flex; }
.ability-bar button {
  font-family: var(--font-clean, Inter, system-ui, sans-serif); font-weight: 700;
  font-size: 12px; border: 1px solid rgba(0,0,0,0.2); background: #fff; border-radius: 8px;
  padding: 6px 8px; cursor: pointer;
}

/* Tool selector */
.tool-selector {
  position: absolute; left: 10px; top: 10px; display: flex; gap: 8px;
  background: rgba(0,0,0,0.7); padding: 8px; border-radius: 8px; z-index: 5;
}
.tool-btn {
  width: 40px; height: 40px; border: 2px solid #555; border-radius: 6px;
  background: #333; color: #fff; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.tool-btn:hover { border-color: #888; transform: scale(1.05); }
.tool-btn.active { border-color: #4a9b5c; background: #2d6b3c; }
.tool-btn.locked { opacity: 0.3; cursor: not-allowed; }

/* Extra shops and UI */
.axe-shop, .bucket-shop, .creative-btn, .place-wood-btn {
  position: absolute;
  right: -220px;
  top: 50%;
  transform: translateY(-50%);
  display: flex; align-items: center; gap: 10px;
  background: #2d6b3c; color: #fff; border-radius: 14px 0 0 14px;
  padding: 10px 14px; font-family: var(--font-clean, Inter, system-ui, sans-serif);
  font-weight: 700; box-shadow: 0 6px 14px rgba(0,0,0,.12);
  cursor: pointer; z-index: 5; transition: right .28s ease;
}
.axe-shop.show, .bucket-shop.show { right: 8px; }

/* small top button for Creative Mode and Place Wood */
.creative-btn, .place-wood-btn {
  top: 10px; right: 10px; transform: none; border-radius: 10px;
}
.creative-btn.hidden, .place-wood-btn.hidden { display: none; }

/* right sidebar palette */
.palette {
  position: absolute; top: 0; right: -220px; width: 200px; height: 100%;
  background: #f5f5f5; border-left: 2px solid rgba(0,0,0,.08);
  box-shadow: -6px 0 14px rgba(0,0,0,.08);
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
  transition: right .28s ease; z-index: 6;
}
.palette.show { right: 0; }
.palette .tile {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 6px 8px; border-radius: 8px; background: #fff; border: 1px solid #e7e7e7;
}
.palette .swatch { width: 18px; height: 18px; border: 1px solid rgba(0,0,0,.2); }
.popup-toast {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  background: #111; color: #fff; padding: 8px 12px; border-radius: 8px;
  font-family: var(--font-clean, Inter, system-ui, sans-serif);
  font-weight: 700; opacity: 0; transition: opacity .2s ease, transform .2s ease; z-index: 7;
}
.popup-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* === RESPONSIVE === */
/* Mobile-first: Header defaults to vertical layout */
.header-left-v4 {
  flex-direction: column;
  gap: 0.25rem;
  align-items: flex-start;
}

.logo-text-v4 {
  font-size: 1.5rem;
}

.hub-title-v4 {
  font-size: 1.2rem;
}

.game-navigation-v4 {
  flex-direction: column;
}

.nav-arrow-v4 {
  width: 100%;
  justify-content: center;
}

/* Desktop: Horizontal header layout */
@media (min-width: 968px) {
  .header-left-v4 {
    flex-direction: row;
    gap: 1.5rem;
    align-items: baseline;
  }

  .logo-text-v4 {
    font-size: 2rem;
  }

  .hub-title-v4 {
    font-size: 1.5rem;
  }

  .game-navigation-v4 {
    flex-direction: row;
  }

  .nav-arrow-v4 {
    width: auto;
  }
}
