@import url('https://fonts.googleapis.com/css2?family=Pacifico&family=Quicksand:wght@400;700&display=swap');

:root {
  --bg-color: #fce4ec;
  --container-color: rgba(255, 255, 255, 0.7);
  --primary-color: #ff80ab;
  --secondary-color: #f48fb1;
  --text-color: #880e4f;
  --header-font: 'Pacifico', cursive;
  --body-font: 'Quicksand', sans-serif;
}

body {
  background-color: var(--bg-color);
  background-image: url('https://www.transparenttextures.com/patterns/subtle-white-feathers.png');
  color: var(--text-color);
  font-family: var(--body-font);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

.top-menu {
  width: 100%;
  background: var(--container-color);
  backdrop-filter: blur(5px);
  padding: 10px 20px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  overflow-x: auto;
  white-space: nowrap;
  justify-content: flex-start;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}
.top-menu a {
  color: var(--text-color);
  text-decoration: none;
  font-family: var(--header-font);
  font-size: 1.2em;
  margin: 0 15px;
  transition: color 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.top-menu a:hover {
  color: var(--primary-color);
}
.menu-icon {
  height: 1.2em;
  width: auto;
}

header h1 {
  font-family: var(--header-font);
  color: var(--primary-color);
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
  text-align: center;
  font-size: 4em;
  margin: 30px 0;
}

main.generator {
  display: grid;
  grid-template-columns: 250px 1fr 450px;
  gap: 30px;
  width: 100%;
  max-width: 1400px;
  z-index: 10;
  padding: 0 20px;
  box-sizing: border-box;
}

.categories, .traits, .preview-container {
  background-color: var(--container-color);
  backdrop-filter: blur(5px);
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

h2 {
  font-family: var(--header-font);
  color: var(--primary-color);
  border-bottom: 2px dashed var(--primary-color);
  padding-bottom: 10px;
  margin-top: 0;
  text-align: center;
}

#category-buttons, #trait-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--body-font);
  font-weight: 700;
  font-size: 1em;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
button:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0,0,0,0.15);
}

.preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

#preview {
  width: 400px;
  height: 400px;
  border: 5px solid rgb(255, 85, 246);
  background-color: rgba(0,0,0,0.05);
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.1);
}

/* --- Preloader Minigame Styles --- */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    background-color: var(--bg-color);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: opacity 0.75s ease, visibility 0.75s ease;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    color: var(--text-color);
}

.preloader-instructions {
    font-family: var(--header-font);
    font-size: 2.5em;
    margin-bottom: 20px;
}

#strawberry-clicker {
    width: 250px;
    cursor: pointer;
    transition: transform 0.1s ease-out;
    margin-bottom: 20px;
}

#strawberry-clicker:active {
    transform: scale(0.9);
}

.preloader-score {
    font-weight: 700;
    font-size: 1.2em;
}

.loading-bar-container {
    width: 250px;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    margin: 20px auto;
    overflow: hidden;
}

.loading-bar {
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    animation: loading-pulse 2s infinite ease-in-out;
}

.preloader-status {
    font-size: 0.9em;
    opacity: 0.8;
}

@keyframes loading-pulse {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0%); }
    100% { transform: translateX(100%); }
}

.preview-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#download-btn, #random-btn, #reset-btn {
  width: 100%;
  padding: 15px;
}

.music-player {
  width: 100%;
  background: rgba(255,255,255,0.5);
  border-radius: 15px;
  padding: 10px 15px;
  text-align: center;
  box-sizing: border-box;
}
.music-player .song-artist {
    font-size: 0.8em;
    opacity: 0.8;
    margin-bottom: 2px;
}
.music-player .song-title {
  font-weight: 700;
  margin-bottom: 10px;
}
.music-player .controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.music-player button {
  padding: 8px 12px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
}
#prev-btn, #next-btn {
    padding: 8px;
    width: 35px;
    height: 35px;
}
#volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 50%;
  height: 8px;
  background: #f8bbd0;
  border-radius: 5px;
  outline: none;
  opacity: 0.7;
  transition: opacity .2s;
}
#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
}

.showcase-container {
  width: 100%;
  margin-top: 50px;
  padding: 20px 0;
  background: var(--container-color);
  backdrop-filter: blur(5px);
  overflow: hidden;
}
.marquee {
  width: 100%;
  white-space: nowrap;
}
.marquee-content {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 60s linear infinite;
}
.marquee-content img {
  height: 120px;
  width: 120px;
  border-radius: 15px;
  margin: 0 15px;
  border: 4px solid white;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Prevent scrolling when preloader is active */
body.preloader-active {
    overflow: hidden;
}

.bubbles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    z-index: -1;
}
.bubble {
    position: absolute;
    bottom: -150px;
    background: rgba(255, 128, 171, 0.2);
    border-radius: 50%;
    animation: float-up 25s linear infinite;
}
@keyframes float-up {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0.5;
    }
    100% {
        transform: translateY(-120vh) translateX(100px);
        opacity: 0;
    }
}

/* --- Mobile Responsive Design --- */
.mobile-controls {
    display: none; /* Hidden on desktop */
    width: 100%;
    padding: 0 20px 20px 20px;
    box-sizing: border-box;
    gap: 15px;
}

@media (max-width: 900px) {
    main.generator {
        grid-template-columns: 1fr;
        max-width: 100%;
        padding: 0 20px;
        gap: 20px;
    }
    .mobile-controls {
        display: flex;
    }
    .categories, .traits {
        display: none;
    }
    .categories.visible, .traits.visible {
        display: block;
    }
    header h1 {
        font-size: 3em;
        margin: 20px 0;
    }
    .preview-container {
        /* No grid-row needed */
    }
    #preview {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        max-width: 400px;
    }
    .top-menu a {
        font-size: 1.1em;
        margin: 0 10px;
    }
    .showcase-container {
        margin-top: 30px;
    }
    .marquee-content img {
        height: 100px;
        width: 100px;
    }
}

#back-to-categories-btn {
    display: none;
    margin-bottom: 15px;
    background-color: #a1887f;
}

@media (max-width: 900px) {
    #back-to-categories-btn {
        display: block;
    }
}

/* Style the enter button and hide it by default */
#enter-btn {
    display: none;
    margin-top: 30px;
    padding: 15px 30px;
    font-size: 1.5em;
    font-family: var(--header-font);
    border-radius: 30px;
    cursor: pointer;
}

/* When the preloader has the 'loaded' class, hide the loading indicator */
#preloader.loaded .loading-indicator {
    display: none;
}

/* When the preloader has the 'loaded' class, show the enter button */
#preloader.loaded #enter-btn {
    display: inline-block;
    animation: fade-in 0.5s ease;
}

/* A simple fade-in animation for the button */
@keyframes fade-in {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* --- Preloader 'Berry' Pop Effect --- */
.berry-pop {
    position: absolute; /* Allows positioning based on the click */
    z-index: 10000; /* Ensures it's on top of everything */
    pointer-events: none; /* Prevents the text from interfering with clicks */
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
    /* The animation call */
    animation: floatAndFade 2s ease-out forwards;
}

/* The animation definition */
@keyframes floatAndFade {
    from {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    to {
        opacity: 0;
        /* Floats up by 150px, rotates, and shrinks */
        transform: translateY(-150px) rotate(15deg) scale(0.5);
    }
}