/* VARIABLES & THEMES */
:root {
  /* Default (Stone Age) Colors */
  --bg-color: #5c4e3c;
  --panel-bg: #c2b280;
  --text-color: #2e271d;
  --accent-color: #8c7b56;
  --btn-primary: #e67e22;
  --btn-shadow: #a04000;
  --display-bg: #3e3832;
  --display-text: #a8d5ba;
}

/* MEDIEVAL THEME OVERRIDE */
body.bg-medieval {
  --bg-color: #2c3e50;
  --panel-bg: #95a5a6;
  --text-color: #1a1a1a;
  --accent-color: #7f8c8d;
  --btn-primary: #f1c40f;
  --btn-shadow: #b7950b;
  --display-bg: #000000;
  --display-text: #f1c40f;
}

/* FUTURE THEME OVERRIDE */
body.bg-future {
  --bg-color: #050510;
  --panel-bg: #111122;
  --text-color: #00ffcc;
  --accent-color: #3333aa;
  --btn-primary: #ff00ff;
  --btn-shadow: #990099;
  --display-bg: #000000;
  --display-text: #00ffcc;
  /* Add a grid background for future */
  background-image: 
    linear-gradient(rgba(0, 255, 204, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 204, 0.1) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* BASE STYLES */
* {
  box-sizing: border-box;
  image-rendering: pixelated;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-color);
  font-family: 'VT323', monospace;
  color: var(--text-color);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.5s step-end;
}

/* THE GAME BOY / PANEL CARD */
.panel {
  width: 100%;
  max-width: 380px;
  background: var(--panel-bg);
  border: 4px solid #000;
  padding: 2rem;
  /* The "Pixel Shadow" Effect */
  box-shadow: 
    8px 8px 0px 0px rgba(0,0,0,0.5); 
  position: relative;
  text-align: center;
}

/* TITLES */
.pixel-header, #game-title {
  font-family: 'Press Start 2P', cursive;
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  line-height: 1.5;
  text-shadow: 2px 2px 0px rgba(0,0,0,0.2);
}

.pixel-sub {
  font-size: 1.4rem;
  margin-bottom: 2rem;
}

/* THE RESOURCE DISPLAY */
.currency-display {
  position: relative;
  background: var(--display-bg);
  color: var(--display-text);
  padding: 1rem;
  margin-bottom: 1.5rem;
  border: 4px solid rgba(0,0,0,0.3);
  border-radius: 4px;
  font-family: 'VT323', monospace;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
  min-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.currency-display::after {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.1) 50%
  );
  background-size: 100% 4px; /* Creates the scanlines */
  pointer-events: none; /* Let clicks pass through */
}

#currency-amount {
  display: block;
  font-size: 3.5rem;
  line-height: 1;
}

#currency-name {
  display: block;
  font-size: 1.2rem;
  text-transform: uppercase;
  opacity: 0.8;
  letter-spacing: 2px;
}

/* PIXEL BUTTONS */
.actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pixel-btn {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.8rem;
  padding: 1rem;
  border: 4px solid #000;
  cursor: pointer;
  text-transform: uppercase;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  
  /* Initial State */
  background: #fff;
  color: #000;
  box-shadow: 
    inset -4px -4px 0px 0px rgba(0,0,0,0.2);
  
  transition: transform 0.1s;
}

/* PRIMARY ACTION (Gather) */
.pixel-btn.primary {
  background: var(--btn-primary);
  color: #fff;
  border-color: #000;
}

/* SECONDARY ACTION (Evolve) */
.pixel-btn.secondary {
  background: #444;
  color: #fff;
  border: 4px dashed #fff;
}

.pixel-btn:hover {
  transform: translateY(-2px);
}

.pixel-btn:active {
  transform: translateY(2px);
  box-shadow: inset 4px 4px 0px 0px rgba(0,0,0,0.2);
}

.px {
  font-size: 1.2rem;
}

/* FUTURE THEME EXTRAS */
body.bg-future .currency-display {
  box-shadow: 0 0 15px var(--display-text), inset 0 0 10px rgba(0,0,0,0.8);
  text-shadow: 0 0 5px var(--display-text);
}

.shop-container {
  margin-top: 2rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.1);
}

.shop-list {
  display: grid;
  gap: 10px;
}

.shop-item {
  background: var(--panel-bg);
  border: 4px solid #000;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.1s;
}

.shop-item:hover {
  filter: brightness(1.1);
}

.shop-item.locked {
  opacity: 0.5;
  filter: grayscale(1);
  cursor: not-allowed;
}

.shop-info {
  text-align: left;
}

.shop-info h4 {
  margin: 0;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
}

.shop-info p {
  margin: 5px 0 0 0;
  font-size: 1rem;
}

.buy-btn {
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  padding: 5px 10px;
  background: #2ecc71;
  border: 3px solid #000;
  cursor: pointer;
}

.buy-btn:disabled {
  background: #95a5a6;
  cursor: not-allowed;
}

.pixel-divider {
  border: none;
  height: 4px;
  background: rgba(0, 0, 0, 0.2);
  margin: 1.5rem 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.shop-container {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Custom scrollbar for retro look */
.shop-container::-webkit-scrollbar {
  width: 8px;
}
.shop-container::-webkit-scrollbar-thumb {
  background: var(--text-color);
  border: 2px solid var(--panel-bg);
}

.bg-classical {
  --bg-color: #87CEEB;
  --panel-bg: #F5F5DC;
  --text-color: #2F4F4F;
  --display-text: #4682B4;
}

.bg-industrial {
  --bg-color: #4b3621;
  --panel-bg: #708090;
  --text-color: #2c2c2c;
  --display-text: #ff4500;
}
