/* Saftladen 2.0 - Base Styles */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Space Mono', 'Courier New', monospace;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

/* HUD Overlay */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  font-family: 'Space Mono', monospace;
}

#resource-bar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 48px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  border-radius: 16px;
  padding: 16px 40px;
  color: #fff;
  font-size: 32px;
  font-weight: 700;
}

.resource {
  display: flex;
  align-items: center;
  gap: 12px;
}

.resource-value {
  transition: color 0.1s, text-shadow 0.1s;
}

.resource-value.flash {
  color: #F2C318;
  text-shadow: 0 0 8px #F2C318;
}

/* Interaction Label - positioned at entity */
#interact-label {
  position: absolute;
  transform: translate(-50%, -100%);
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#interact-label.visible {
  opacity: 1;
}

#interact-label::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(0,0,0,0.8);
}

/* Phase Info */
#phase-info {
  position: absolute;
  bottom: 24px;
  left: 20px;
  color: rgba(255,255,255,0.85);
  font-size: 32px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  border-radius: 16px;
  padding: 16px 24px;
}

#phase-name {
  font-weight: 700;
  margin-bottom: 8px;
}

#phase-progress {
  width: 240px;
  height: 12px;
  background: rgba(255,255,255,0.2);
  border-radius: 6px;
  overflow: hidden;
}


#phase-progress-bar {
  height: 100%;
  background: #F2C318;
  transition: width 0.3s;
}

/* Event Banner */
#event-banner {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #E91E63;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  letter-spacing: 0.5px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 12px;
}

#event-banner.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.event-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.event-timer {
  background: rgba(0,0,0,0.3);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  min-width: 40px;
  text-align: center;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 6px;
  z-index: 50;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Shop Overlay */
#shop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  font-family: 'Space Mono', monospace;
}

#shop.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.shop-container {
  background: #1a1a1a;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  border: 1px solid #333;
  position: relative;
  z-index: 1;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #333;
  background: #222;
}

.shop-title {
  color: #F2C318;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
}

.shop-money {
  color: #F2C318;
  font-size: 22px;
  font-weight: 700;
  background: rgba(242, 195, 24, 0.15);
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid #F2C318;
  text-shadow: 0 0 10px rgba(242, 195, 24, 0.5);
}

.shop-close {
  background: none;
  border: none;
  color: #666;
  font-size: 20px;
  cursor: pointer;
  pointer-events: auto;
}

.shop-close:hover {
  color: #fff;
}

.shop-tabs {
  display: flex;
  border-bottom: 1px solid #333;
}

.shop-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: #666;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  pointer-events: auto;
  transition: color 0.2s, background 0.2s;
}

.shop-tab:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.shop-tab.active {
  color: #F2C318;
  border-bottom: 2px solid #F2C318;
}

.shop-content {
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.upgrade-card {
  background: #252525;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid #333;
}

.upgrade-card.locked {
  opacity: 0.5;
}

.upgrade-card.affordable .upgrade-buy {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 195, 24, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(242, 195, 24, 0); }
}

.upgrade-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.upgrade-name {
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.upgrade-icon {
  font-size: 18px;
}

.upgrade-cost {
  color: #F2C318;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(242, 195, 24, 0.4);
}

.upgrade-desc {
  color: #888;
  font-size: 12px;
  margin-bottom: 10px;
}

.upgrade-unlock-progress {
  color: #666;
  font-size: 11px;
  margin-bottom: 8px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  text-align: center;
}

.upgrade-level {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.upgrade-level-bar {
  flex: 1;
  height: 4px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
}

.upgrade-level-fill {
  height: 100%;
  background: #F2C318;
}

.upgrade-level-text {
  color: #666;
  font-size: 11px;
}

.upgrade-buy {
  width: 100%;
  padding: 8px;
  background: #F2C318;
  border: none;
  border-radius: 4px;
  color: #000;
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  pointer-events: auto;
}

.upgrade-buy:disabled {
  background: #444;
  color: #666;
  cursor: not-allowed;
}

/* Screens Overlay */
#screens {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

#screens > * {
  pointer-events: auto;
}

/* Achievement Toast */
.achievement {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
  color: #fff;
  font-family: 'Space Mono', monospace;
  font-size: 24px;
  padding: 24px 32px;
  border-radius: 16px;
  border-left: 6px solid #F2C318;
  z-index: 200;
  animation: slideIn 0.4s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.achievement-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.achievement-name {
  font-weight: 700;
  color: #F2C318;
  font-size: 28px;
}

.achievement-desc {
  color: #aaa;
  margin-top: 6px;
  max-width: 400px;
  font-size: 20px;
}

/* Phase Transition Overlay */
.phase-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  animation: phaseIn 0.5s ease, phaseOut 0.5s ease 1.5s forwards;
}

@keyframes phaseIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes phaseOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-50px); }
}

.phase-overlay-text {
  font-size: clamp(24px, 5vw, 48px);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 4px 20px rgba(0,0,0,0.5);
  letter-spacing: 4px;
}

/* End Screen */
.end-screen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  animation: fadeIn 1s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.end-content {
  text-align: center;
  color: #fff;
  font-family: 'Space Mono', monospace;
}

.end-content h1 {
  font-size: clamp(32px, 8vw, 72px);
  color: #FFD700;
  margin-bottom: 32px;
  letter-spacing: 6px;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.end-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 32px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.stat {
  background: rgba(255,255,255,0.1);
  padding: 16px;
  border-radius: 8px;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
}

.stat-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #F2C318;
}

.end-message {
  font-size: 20px;
  margin-bottom: 32px;
  color: #4CAF50;
}

.end-restart {
  background: #F2C318;
  border: none;
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.end-restart:hover {
  transform: scale(1.05);
}
