:root {
  --bg: #0b0f14;
  --panel: #1a1a1a;
  --text: #e8eef7;
  --accent: #00ff00; /* RA2 Green text */
  --border: #333;
}

* { box-sizing: border-box; user-select: none; }

body {
  margin: 0;
  overflow: hidden;
  background: #000;
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#app { width: 100vw; height: 100vh; position: relative; }
#canvas-container { width: 100%; height: 100%; }

/* --- SIDEBAR UI (RA2 Style) --- */
#sidebar {
  position: absolute;
  top: 0;
  right: 0;
  width: 280px;
  height: 100%;
  background: var(--panel);
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 20;
  box-shadow: -5px 0 15px rgba(0,0,0,0.5);
}

/* Minimap Box */
.radar-box {
  width: 260px;
  height: 260px; /* Kvadratisk för enkelhet */
  margin: 10px;
  background: #000;
  border: 1px solid #555;
  position: relative;
}

#radar-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
}

/* Power Bar */
.power-strip {
  width: 15px;
  height: 260px;
  background: #111;
  border: 1px solid #444;
  position: absolute;
  left: -20px;
  top: 10px;
  display: flex;
  flex-direction: column-reverse;
}

.power-fill {
  width: 100%;
  background: linear-gradient(to top, #00ff00, #ffff00);
  transition: height 0.5s;
}

.power-fill.low-power {
  background: #ff0000;
  box-shadow: 0 0 10px #ff0000;
}

.power-marker {
  position: absolute;
  width: 100%;
  height: 2px;
  background: #fff;
  z-index: 5;
  transition: bottom 0.5s;
}

/* Money Display */
.credits {
  font-family: 'Courier New', monospace;
  color: var(--accent);
  font-size: 24px;
  font-weight: bold;
  text-align: right;
  padding: 5px 15px;
  border-bottom: 1px solid #333;
  text-shadow: 0 0 5px #005500;
}

/* Build Tabs (Structure / Unit) */
.tab-container {
  display: flex;
  background: #222;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 8px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 12px;
  text-transform: uppercase;
  color: #888;
}
.tab.active {
  color: #fff;
  border-bottom: 2px solid var(--accent);
  background: #333;
}

/* Build Grid */
.build-menu {
  padding: 5px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  overflow-y: auto;
  flex: 1;
}

.build-item {
  background: #2a2a2a;
  border: 1px solid #444;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: 0.1s;
}

.build-item:hover { border-color: #fff; background: #333; }
.build-item:active { transform: scale(0.98); }

.build-item.disabled { opacity: 0.4; filter: grayscale(1); cursor: not-allowed; }
.build-item.building { border-color: #ffff00; }
.build-item.ready { border-color: #00ff00; background: #1a331a; animation: pulse 1s infinite; }

.build-icon { font-size: 24px; margin-bottom: 4px; }
.build-label { font-size: 10px; text-transform: uppercase; text-align: center; }
.build-cost { font-size: 10px; color: gold; }

/* Progress Overlay */
.progress-overlay {
  position: absolute;
  bottom: 0; left: 0;
  height: 100%;
  width: 0%;
  background: rgba(255, 255, 255, 0.1);
  pointer-events: none;
  transition: width 0.1s linear;
}

.queue-badge {
  position: absolute;
  top: 2px; left: 2px;
  font-size: 10px;
  font-weight: bold;
  color: var(--accent);
}

/* Game Over Overlay */
#game-over-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: none;
    flex-direction: column; justify-content: center; align-items: center;
    z-index: 999;
}
#game-over-msg { font-size: 48px; font-weight: bold; color: white; margin-bottom: 20px; text-transform: uppercase; }
.btn-restart { padding: 15px 30px; font-size: 18px; cursor: pointer; background: #444; color: #fff; border: 1px solid #666; }

/* Selection Box */
#select-box {
  position: absolute;
  border: 1px solid #00ff00;
  background: rgba(0, 255, 0, 0.2);
  z-index: 10;
  pointer-events: none;
  
  
}

/* Lägg till detta i din <style> eller styles.css */
#tutorial-box {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 300px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #00ff00;
    color: #eee;
    padding: 15px;
    font-family: 'Segoe UI', sans-serif;
    z-index: 20;
    pointer-events: none; /* Så man kan klicka igenom den */
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}
#tutorial-title {
    color: #00ff00;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    margin-bottom: 5px;
}
#tutorial-step {
    font-size: 16px;
    line-height: 1.4;
}

@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.7; } 100% { opacity: 1; } }