:root {
  --bg-dark: #1e2124;
  --panel-bg: #282b30;
  --text-gold: #ffd700;
  --btn-green: #43b581;
  --btn-red: #f04747;
  --text-white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--bg-dark);
  color: var(--text-white);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  overflow: hidden;
  display: flex;
  height: 100vh;
  width: 100vw;
}

#app-layout {
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: row;
}

#game-container {
  position: relative;
  flex: 1;
  background-color: #111;
  display: flex;
  justify_content: center;
  align-items: center;
  overflow: hidden;
}

canvas {
  max-width: 95%;
  max-height: 95%;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}

#top-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  border-bottom: 1px solid var(--text-gold);
  z-index: 10;
  pointer-events: none;
}
.top-stat {
  font-size: 16px;
  font-weight: bold;
  white-space: nowrap;
}
.money {
  color: var(--btn-green);
}
.stock {
  color: var(--text-gold);
}

#sidebar {
  width: 320px;
  min-width: 300px;
  background-color: var(--panel-bg);
  border-left: 2px solid var(--text-gold);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  z-index: 20;
}

/* RESPONSIVE */
@media (max-width: 850px) {
  #app-layout {
    flex-direction: column;
  }
  #game-container {
    flex: 2;
    height: 60%;
  }
  #sidebar {
    width: 100%;
    height: 40%;
    flex: 1;
    border-left: none;
    border-top: 2px solid var(--text-gold);
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
    padding: 10px;
  }
  #sidebar > h1 {
    width: 100%;
    font-size: 18px;
    margin-bottom: 5px;
  }
  #panel-info {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .info-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .stats-row {
    width: 100%;
    display: flex;
    gap: 10px;
  }
  .stat-box {
    flex: 1;
    font-size: 12px;
  }
  #actions-own,
  #actions-enemy {
    width: 100%;
    display: flex;
    gap: 5px;
  }
  button {
    padding: 8px;
    font-size: 14px;
  }
  #game-log {
    display: none;
  }
}

h1 {
  margin: 0;
  font-size: 22px;
  color: var(--text-gold);
  text-align: center;
}
h2 {
  margin: 0;
  font-size: 20px;
  color: var(--text-white);
}
.faction-tag {
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 14px;
}
.stat-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 8px;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  border: 1px solid #444;
}

button {
  padding: 10px;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  font-size: 14px;
  color: white;
  transition: 0.1s;
}
button:active {
  transform: scale(0.96);
}
.btn-upgrade {
  background-color: var(--btn-green);
  flex: 1;
}
.btn-recruit {
  background-color: #555;
  flex: 1;
}
.btn-attack {
  background-color: var(--btn-red);
  width: 100%;
}
.btn-distribute {
  background-color: var(--text-gold);
  color: black;
  width: 100%;
  margin-top: 5px;
}

#controls-move {
  display: flex;
  align-items: center;
  background: #333;
  border-radius: 5px;
  padding: 0 5px;
}
.btn-tiny {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 18px;
  background: #7289da;
}
#loading {
  position: absolute;
  color: white;
  font-size: 20px;
}
