@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800;900&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  /* Theme Colors */
  --bg-pitch-black: #000000;
  --bg-card-surface: #0a0a0d;
  --bg-card-elevated: #121217;
  --bg-glass: rgba(18, 18, 23, 0.85);

  /* LEGO Signature Colors */
  --lego-blue: #0055BF;
  --lego-blue-bright: #006CB7;
  --lego-blue-dark: #003E8A;
  --lego-blue-glow: rgba(0, 108, 183, 0.4);

  --lego-green: #00A859;
  --lego-green-bright: #00C86B;
  --lego-green-glow: rgba(0, 168, 89, 0.45);

  --lego-yellow: #FFD500;
  --lego-red: #E3000B;
  --lego-orange: #FF7E00;

  /* Accent & Feedback Colors */
  --accent-cyan: #00D2FF;
  --accent-cyan-glow: rgba(0, 210, 255, 0.35);
  --success-emerald: #10B981;
  --error-coral: #EF4444;

  /* Typography */
  --text-white: #FFFFFF;
  --text-dim: #A1A1AA;
  --text-muted: #71717A;

  /* Geometry & Shadows */
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Space Grotesk', monospace;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.8);
  --shadow-glow: 0 0 25px rgba(0, 85, 191, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-pitch-black);
  color: var(--text-white);
  font-family: var(--font-main);
  overflow-x: hidden;
}

/* Background Atmosphere */
body {
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(0, 85, 191, 0.12) 0%, transparent 65%),
    radial-gradient(circle at 80% 80%, rgba(0, 168, 89, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 10% 90%, rgba(0, 210, 255, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}

#app-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Header styling */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-subtle);
  position: relative;
  z-index: 10;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lego-brick-logo {
  display: flex;
  gap: 4px;
}

.logo-stud {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--lego-blue);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 2px 4px rgba(0, 0, 0, 0.5);
}
.logo-stud.green { background: var(--lego-green); }
.logo-stud.yellow { background: var(--lego-yellow); }
.logo-stud.red { background: var(--lego-red); }

.brand-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-white);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title span.badge {
  font-size: 0.7rem;
  background: var(--lego-blue);
  color: var(--text-white);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
}

.stat-pill .icon {
  font-size: 1.1rem;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Main Workspace */
.game-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  position: relative;
}

/* Footer / Sound Bar */
.footer-bar {
  margin-top: auto;
  padding: 16px 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-bar a {
  color: var(--lego-blue-bright);
  text-decoration: none;
}

/* Games Hub Screen (12-Box Grid) */
.hub-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}

.hub-hero {
  text-align: center;
  margin: 10px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.hub-main-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text-white);
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #FFFFFF, var(--accent-cyan), #FFFFFF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hub-subtitle {
  color: var(--text-dim);
  font-size: 1.05rem;
  max-width: 600px;
}

/* 12 Boxes Grid Layout */
.hub-grid-12 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  width: 100%;
}

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

@media (max-width: 720px) {
  .hub-grid-12 {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

@media (max-width: 460px) {
  .hub-grid-12 {
    grid-template-columns: 1fr;
  }
}

/* Generic Hub Box */
.hub-box {
  height: 280px;
  min-height: 280px;
  border-radius: var(--radius-lg);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 22px 16px 18px 16px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

/* Active Game Box (Box 1 & Box 2) */
.hub-box.active-game-box {
  background: linear-gradient(180deg, #0e2215 0%, #07130b 100%);
  border: 2px solid var(--lego-green);
  box-shadow: 
    0 6px 0 #006636,
    0 10px 25px rgba(0, 168, 89, 0.35),
    0 0 15px var(--lego-green-glow);
  cursor: pointer;
}

#box-game-clock.active-game-box {
  background: linear-gradient(180deg, #0b1a2e 0%, #050d18 100%);
  border-color: var(--lego-blue);
  box-shadow: 
    0 6px 0 #003E8A,
    0 10px 25px rgba(0, 85, 191, 0.35),
    0 0 15px rgba(0, 210, 255, 0.3);
}

.hub-box.active-game-box:hover {
  transform: translateY(-8px) scale(1.03);
  border-color: #00E676;
  box-shadow: 
    0 8px 0 #006636,
    0 16px 35px rgba(0, 168, 89, 0.55),
    0 0 30px rgba(0, 230, 118, 0.6);
}

#box-game-clock.active-game-box:hover {
  border-color: #00D2FF;
  box-shadow: 
    0 8px 0 #003E8A,
    0 16px 35px rgba(0, 85, 191, 0.6),
    0 0 30px rgba(0, 210, 255, 0.6);
}

.hub-box.active-game-box:active {
  transform: translateY(2px) scale(0.98);
  box-shadow: 0 2px 0 #006636, 0 6px 12px rgba(0, 0, 0, 0.6);
}

.box-ribbon-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--lego-green);
  color: #000000;
  font-size: 0.65rem;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}

#box-game-rando {
  border-color: #F59E0B;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3);
}

#box-game-rando .box-ribbon-badge {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #FFFFFF;
}

#box-game-clock .box-ribbon-badge {
  background: #00D2FF;
  color: #050d18;
}

/* Uniform Animal Avatar Stage in Hub Cards */
.rando-avatar-stage,
.frog-avatar-stage,
.penguin-avatar-stage,
.hub-avatar-stage {
  width: 96px;
  height: 96px;
  min-width: 96px;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  transition: transform 0.25s ease;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7));
}

.rando-avatar-stage svg,
.frog-avatar-stage svg,
.penguin-avatar-stage svg,
.hub-avatar-stage svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.active-game-box:hover .rando-avatar-stage,
.active-game-box:hover .frog-avatar-stage,
.active-game-box:hover .penguin-avatar-stage {
  transform: scale(1.12) rotate(-3deg);
}

/* Aligned Text Info Rows */
.box-info {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 10px;
}

.box-title {
  font-size: 1.45rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--text-white);
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
}

.box-subtitle {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.25;
  width: 100%;
  padding: 0 4px;
}

.play-quest-btn {
  width: 100%;
  margin-top: auto;
  padding: 9px 14px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Locked Boxes with Stuck Fly */
.hub-box.locked-box {
  background: rgba(18, 18, 23, 0.5);
  border: 2px dashed rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  justify-content: center;
}

.hub-box.locked-box:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
}

.stuck-fly-container {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  transform: rotate(12deg);
  transition: transform 0.2s ease;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.8));
}

.locked-box:hover .stuck-fly-container {
  transform: rotate(-15deg) scale(1.15);
}

.locked-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.locked-icon {
  font-size: 2rem;
  opacity: 0.5;
}

.locked-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-muted);
}

.locked-tag {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #app-container, .hub-container {
    padding: 10px 12px;
  }
  .header-bar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
  }
  .brand-title {
    font-size: 1.1rem;
  }
  .stat-pill {
    padding: 4px 8px;
    font-size: 0.85rem;
  }
}

/* Rando Mystery Quest Tour Floating Banner */
.rando-tour-banner {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 50%, #4338CA 100%);
  border: 2px solid #F59E0B;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 24px rgba(245, 158, 11, 0.45);
  color: #FFFFFF;
  padding: 10px 24px;
  border-radius: 30px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: randoBannerPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  pointer-events: none;
}

@keyframes randoBannerPop {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-30px) scale(0.85);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.rando-tour-banner.fade-out {
  opacity: 0;
  transform: translateX(-50%) translateY(-20px) scale(0.95);
  transition: all 0.5s ease;
}


