/*
 * Stylesheet for ninety nine percent remaining — realistic life improvement incremental game
 * Only dark theme is supported. This file defines layout, colors, animations
 * and component styling for the entire game.
 */

/* Root variables for the dark theme (only mode) */
:root {
  --bg: #0e1320;
  --text: #e5e7eb;
  --primary: #5193d1;
  --button-bg: #1e253a;
  --button-text: #e5e7eb;
  --button-border: #39405c;
  --upgrade-border: #39405c;
  --upgrade-bg: #1b2235;
}

/* Global styles */
html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  /* The background image is applied dynamically via JavaScript for randomization */
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
  overflow-x: hidden;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
}

/* Hero header and logo */
.hero-header {
  margin-bottom: 1rem;
}

.hero-logo {
  width: 100%;
  max-width: 800px;
  height: auto;
  margin: 0 auto;
  display: block;
}

.hero-text {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  fill: var(--primary);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}


/* Single‑line title styles.  The title scales based on viewport width and
 * gently pulses to draw the player's attention. */
#gameTitle {
  font-size: clamp(2rem, 8vw, 4rem);
  animation: titlePulse 6s ease-in-out infinite;
}

@keyframes titlePulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

/* Stats */
.stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.stat-item {
  margin: 0.5rem;
  font-size: 1.2rem;
}

/* Focus button */
/* Focus button
 * The focus button now has a pulsing glow to draw the player's attention.
 * It displays a background icon and uses a soft animation to indicate interactivity.
 */
.focus-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  background-color: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 0.8rem 1.5rem;
  font-size: 1.1rem;
  cursor: pointer;
  margin: 1rem auto;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  /* Icon on the left */
  background-image: url('images/focus_icon.png');
  background-repeat: no-repeat;
  background-position: 1rem center;
  background-size: 28px 28px;
  padding-left: 3.2rem;
  /* Pulse animation */
  animation: pulse 2s infinite;
}

.focus-button:hover:not(:disabled) {
  background-color: #407ab8;
  transform: translateY(-2px);
}

.focus-button:active {
  transform: translateY(1px);
}

/* Prestige section */
.prestige {
  text-align: center;
}

.prestige button {
  margin-top: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--button-border);
  background-color: var(--button-bg);
  color: var(--button-text);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.prestige button:hover:not(:disabled) {
  background-color: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}

.prestige button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Bottom controls (prestige + save/load) */
.bottom-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

.save-load {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

.password-control input {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--button-border);
  background-color: var(--button-bg);
  color: var(--button-text);
  border-radius: 4px;
}

.save-load button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--button-border);
  background-color: var(--button-bg);
  color: var(--button-text);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.save-load button:hover:not(:disabled) {
  background-color: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}

.save-load button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Upgrades */
.upgrades {
  text-align: left;
}

/* Tabs for upgrade categories */
.upgrade-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.upgrade-tabs button {
  padding: 0.5rem 1rem;
  background-color: var(--button-bg);
  color: var(--button-text);
  border: 1px solid var(--button-border);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  font-size: 0.9rem;
}
.upgrade-tabs button:hover:not(.active) {
  background-color: var(--primary);
  color: #fff;
}
.upgrade-tabs button.active {
  background-color: var(--primary);
  color: #fff;
}

/* Icon styling within upgrades */
/*
 * Upgrade icons
 *
 * Use images instead of emojis. Increase the default size to improve
 * readability on desktop and mobile. Icons remain square and do not shrink
 * when the upgrade list reflows. Adjust the margin to align with the
 * information column.
 */
.upgrade-icon {
  display: inline-block;
  margin-right: 0.8rem;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

/* Ensure the image inside an upgrade icon fills the container */
.upgrade-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Progress bar styling for each activity.  A thin bar fills as the
 * associated activity timer counts up. */
.progress-bar {
  width: 100%;
  height: 6px;
  background-color: #2a2f45;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.4rem;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--primary);
  transition: width 0.1s linear;
}

.upgrade-list {
  /* Use grid layout to minimize vertical scroll on larger screens */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}

.upgrade {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--upgrade-bg);
  border: 1px solid var(--upgrade-border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  transition: transform 0.2s ease;
}

.upgrade:hover {
  transform: translateY(-2px);
}

.upgrade-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.upgrade-info h3 {
  margin: 0;
  color: var(--primary);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Pulse animation used for the focus button glow. It creates a subtle expanding shadow
 * that repeats infinitely, helping draw the player's eye to the main action button. */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(81, 147, 209, 0.4);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(81, 147, 209, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(81, 147, 209, 0);
  }
}

section,
header {
  animation: fadeIn 0.6s ease;
}