body {
  font-family: 'Lora', serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #fbf8f5;
  margin: 0;
  padding-top: 40px;
  min-height: 100vh;
  box-sizing: border-box; 
  transition: background-color 0.3s ease, color 0.3s ease; 
}

h1 { color: #333; margin-bottom: 10px; }

/* dark mode */
#theme-toggle {
  position: absolute; top: 20px; right: 20px; font-size: 28px;
  background: transparent; border: none; cursor: pointer; transition: transform 0.2s;
}
#theme-toggle:hover { transform: scale(1.2); }

body.dark-mode { background-color: #1a1a1d; }
body.dark-mode h1, 
body.dark-mode h2, 
body.dark-mode #timer-display { color: #e3e3e3; }
body.dark-mode .grid { background-color: #2d2d30; }
body.dark-mode .cell { background-color: #3f3f46; color: #71717a; }
body.dark-mode .cell.filled { color: transparent; }
body.dark-mode #progress-container { background-color: #3f3f46; }
body.dark-mode #game-tip { color: #888; }

/* progress bar & tips */
#progress-container {
  width: 80%; max-width: 400px; height: 12px;
  background-color: #eaddd7; border-radius: 10px;
  margin-bottom: 15px; overflow: hidden; display: none;
}
#progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #ff9ff3, #feca57, #1dd1a1, #70a1ff);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
#game-tip { color: #888; font-size: 14px; margin-bottom: 15px; font-style: italic; }

/* screen management */
.screen { display: none; flex-direction: column; align-items: center; }
.screen.active { display: flex; }

/* main menu */
.level-btn {
  padding: 15px 30px; margin: 10px; font-size: 18px; cursor: pointer;
  border: none; border-radius: 8px; background-color: #cd818b; color: white;
  font-weight: bold; box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s, background-color 0.2s;
}
.level-btn:hover { background-color: #b8737c; transform: translateY(-2px); }

/* game */
.palette { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; justify-content: center; }

.color-btn {
  padding: 10px 15px; font-size: 16px; font-weight: bold; cursor: pointer;
  border: 3px solid transparent; border-radius: 8px; background-color: white;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1); transition: all 0.2s ease;
}
.color-btn.active { border-color: #333; transform: scale(1.1); box-shadow: 0 6px 12px rgba(0,0,0,0.2); }

.color-btn.completed {
  text-decoration: line-through; opacity: 0.5; pointer-events: none;
  background-color: #fbf8f5; border-color: transparent; transform: none; box-shadow: none;
}

.grid {
  display: grid; gap: 2px; background-color: #ccc; padding: 4px;
  border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.cell {
  display: flex; justify-content: center; align-items: center; background-color: #fff;
  font-size: 20px; font-weight: bold; color: #aaa; cursor: pointer;
  user-select: none; transition: background-color 0.3s ease;
}
.cell.filled { color: transparent; }

/* buttons */
.game-buttons { display: flex; gap: 15px; margin-top: 20px; }

.nav-btn {
  padding: 10px 20px; font-size: 16px; cursor: pointer; border: none;
  border-radius: 5px; background-color: #cd818b; color: white; font-weight: bold;
}
.nav-btn:hover { background-color: #b8737c; }

#hint-btn { background-color: #cd818b; color: white; }
#hint-btn:hover { background-color: #8a454d; }

/* hint */
@keyframes pulse-glow {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(254, 202, 87, 0.7); z-index: 10; }
  50% { transform: scale(1.3); box-shadow: 0 0 15px 5px rgba(254, 202, 87, 0.9); z-index: 10; background-color: #ffe6bb; }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(254, 202, 87, 0); z-index: 10; }
}
.hint-glow { animation: pulse-glow 1.5s ease-in-out infinite; position: relative; border-radius: 4px; }

/* win */
#win-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background-color: rgba(0, 0, 0, 0.85); display: none; flex-direction: column;
  justify-content: flex-start; align-items: center; z-index: 100;
  overflow-y: auto; padding: 40px 0; box-sizing: border-box;
}
#win-overlay h2 { color: white; font-size: 36px; margin-bottom: 10px; margin-top: auto; }
#win-time { color: #fbf8f5; font-size: 24px; font-weight: bold; margin-bottom: 20px; }
#enlarged-art-wrapper { transform: scale(1.2); pointer-events: none; margin: 60px 0; }

.win-buttons { display: flex; gap: 15px; align-items: center; margin-bottom: auto; z-index: 101; }
#overlay-menu-btn { margin-top: 0 !important; }

.share-btn {
  padding: 10px 20px; font-size: 16px; cursor: pointer; border: none;
  border-radius: 5px; background-color: #a6545d; color: white; font-weight: bold;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2); transition: background-color 0.2s ease;
}
.share-btn:hover { background-color: #8a454d; }

#timer-display { 
  font-size: 20px; font-weight: bold; color: #cd818b; 
  margin-bottom: 15px; display: none; 
}

/* credit */
#credit-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: #fff;
  padding: 10px 15px;
  border-radius: 30px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  overflow: hidden;
  
  max-width: 45px; 
  white-space: nowrap;
  transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
  z-index: 1000;
}

#credit-popup:hover {
  max-width: 250px; 
}

.credit-heart {
  font-size: 20px;
  color: #cd818b;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
}

.credit-text {
  font-size: 13px;
  color: #555;
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.3s ease;
  transition-delay: 0.1s;
}

#credit-popup:hover .credit-text {
  opacity: 1;
}

body.dark-mode #credit-popup {
  background-color: #2d2d30;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

body.dark-mode .credit-text {
  color: #e3e3e3;
}