:root{
  --bg:#0a0e14;
  --panel:#121826;
  --panel-border:#2a3550;
  --gold:#e0b84a;
  --player:#3fa9f5;
  --ai:#f5473f;
  --neutral:#8a8f9a;
  --text:#e7ecf5;
  font-family:'VT323', monospace;
}

*{box-sizing:border-box;}

html,body{
  margin:0;
  padding:0;
  width:100%;
  height:100%;
  background:var(--bg);
  color:var(--text);
  overflow:hidden;
}

.hidden{display:none !important;}

/* ---------- TITLE SCREEN ---------- */
#title-screen{
  position:relative;
  width:100%;
  height:100vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-end;
  background:#0a0e14 url('images/title-bg.webp') center center / cover no-repeat;
  text-align:center;
}

/* Abgedunkelter Streifen unten übers Titelbild, damit Buttons/Hinweis lesbar bleiben,
   ohne das Bild selbst (das Logo/Credits schon eingebrannt hat) abzudecken. */
.title-overlay{
  position:relative;
  z-index:1;
  width:100%;
  padding:22px 20px 30px 20px;
  background:linear-gradient(to top, rgba(6,9,15,0.92) 0%, rgba(6,9,15,0.75) 55%, rgba(6,9,15,0) 100%);
}

.menu{
  position:relative;
  z-index:1;
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:16px;
}

@media (max-width:480px){
  .menu{ gap:10px; }
  .menu button, #restart-btn{ padding:10px 14px; font-size:12px; }
}

.menu button, #restart-btn{
  font-family:'Press Start 2P', monospace;
  font-size:14px;
  padding:14px 22px;
  background:var(--panel);
  border:3px solid var(--gold);
  color:var(--gold);
  cursor:pointer;
  box-shadow:4px 4px 0 #000;
  transition:transform 0.08s ease;
}

.menu button:hover, #restart-btn:hover{
  transform:translate(-2px,-2px);
  box-shadow:6px 6px 0 #000;
  background:#1c2740;
}

.menu button:active, #restart-btn:active{
  transform:translate(2px,2px);
  box-shadow:1px 1px 0 #000;
}

.hint{
  position:relative;
  z-index:1;
  font-size:20px;
  color:#aab4c8;
  margin:14px auto 0 auto;
  max-width:600px;
}

/* ---------- KARTENOPTIONEN ---------- */
#setup-screen{
  width:100%;
  height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  background:radial-gradient(ellipse at center, #16233d 0%, #0a0e14 75%);
  text-align:center;
  overflow-y:auto;
  padding:28px 16px 40px 16px;
  box-sizing:border-box;
}

.setup-title{
  font-family:'Press Start 2P', monospace;
  font-size:22px;
  color:var(--gold);
  letter-spacing:2px;
  margin-bottom:24px;
  flex:0 0 auto;
}

/* Ordnet die Options-Gruppen nebeneinander an, wenn der Platz reicht, und bricht
   auf schmalen/kurzen Bildschirmen automatisch in mehrere Zeilen um. */
.setup-grid{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:8px 36px;
  max-width:960px;
}

.setup-group{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  margin-bottom:18px;
}

.setup-label{
  font-size:20px;
  color:#aab4c8;
}

.setup-options{
  display:flex;
  gap:10px;
}

.setup-opt{
  font-family:'VT323', monospace;
  font-size:19px;
  padding:10px 20px;
  background:var(--panel);
  border:2px solid var(--panel-border);
  color:var(--text);
  cursor:pointer;
}

.setup-opt:hover{
  border-color:var(--gold);
}

.setup-opt.active{
  border-color:var(--gold);
  background:#2a3a1c;
  color:var(--gold);
}

.setup-opt:disabled{
  cursor:not-allowed;
  opacity:0.4;
}
.setup-opt:disabled:hover{
  border-color:var(--panel-border);
}

.setup-hint{
  font-size:16px;
  color:#5a6478;
  max-width:520px;
  margin:6px 0 10px 0;
}

/* ---------- GAME SCREEN ---------- */
#game-screen{
  width:100%;
  height:100vh;
  display:flex;
  flex-direction:column;
}

#hud{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 18px;
  background:var(--panel);
  border-bottom:3px solid var(--panel-border);
  font-size:22px;
  flex-wrap:wrap;
  gap:10px;
}

#turn-indicator{
  font-family:'Press Start 2P', monospace;
  font-size:14px;
  color:var(--gold);
}

#hud-right{
  display:flex;
  gap:10px;
  align-items:center;
}

#all-moved-indicator{
  font-family:'VT323', monospace;
  font-size:20px;
  color:#5ad65a;
  white-space:nowrap;
}

#units-to-move-counter{
  font-family:'VT323', monospace;
  font-size:20px;
  color:#e0b84a;
  white-space:nowrap;
}

#end-turn-btn, #mute-btn-2, #zoom-in-btn, #zoom-out-btn, #home-btn, #info-btn, #minimap-toggle-btn{
  font-family:'VT323', monospace;
  font-size:20px;
  padding:8px 16px;
  background:#1c2740;
  border:2px solid var(--panel-border);
  color:var(--text);
  cursor:pointer;
}

#zoom-in-btn, #zoom-out-btn, #home-btn, #minimap-toggle-btn{
  padding:8px 12px;
}

#end-turn-btn:hover, #mute-btn-2:hover, #zoom-in-btn:hover, #zoom-out-btn:hover, #home-btn:hover, #info-btn:hover, #minimap-toggle-btn:hover{
  background:#26335a;
  border-color:var(--gold);
}

#map-wrap{
  position:relative;
  flex:1;
  overflow:hidden;
}

#game-canvas{
  display:block;
  width:100%;
  height:100%;
  background:#0d1220;
  cursor:grab;
  image-rendering:pixelated;
}

#game-canvas.dragging{
  cursor:grabbing;
}

#minimap-canvas{
  position:absolute;
  left:12px;
  bottom:12px;
  border:2px solid var(--panel-border);
  background:rgba(10,14,20,0.9);
  cursor:pointer;
  z-index:4;
}

#minimap-canvas.hidden{ display:none; }

/* Kompakte Spieler-Übersicht: rechts oben über der Karte, untereinander statt in einer
   Zeile — spart auf kleinen Monitoren horizontalen Platz gegenüber der alten HUD-Zeile. */
#owner-panel{
  position:absolute;
  top:12px;
  right:12px;
  z-index:4;
  display:flex;
  flex-direction:column;
  gap:4px;
  background:rgba(10,14,20,0.75);
  border:2px solid var(--panel-border);
  padding:6px 10px;
  font-family:'VT323', monospace;
}

.owner-row{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:18px;
  white-space:nowrap;
}

.owner-row.owner-dead{
  opacity:0.45;
  text-decoration:line-through;
}

.owner-row.owner-dominant{
  outline:1px solid #e0473f;
  background:rgba(224,71,63,0.12);
}

.coalition-banner{
  font-size:15px;
  color:#e0473f;
  font-weight:bold;
  white-space:nowrap;
  border-bottom:1px solid var(--panel-border);
  padding-bottom:4px;
  margin-bottom:2px;
}

.owner-name{
  font-weight:bold;
  min-width:2.6em;
}

.owner-stat{
  color:var(--text);
}

#info-panel{
  padding:10px 18px 4px 18px;
  background:var(--panel);
  font-size:20px;
  min-height:28px;
  color:#c8d0e0;
}

/* Schwebende Aktionsleiste links über der Karte statt einer festen Leiste unten —
   erscheint nur, wenn eine Einheit tatsächlich Aktionen anzubieten hat. */
#unit-actions{
  position:absolute;
  top:12px;
  left:12px;
  z-index:5;
  display:flex;
  flex-direction:column;
  gap:8px;
  max-height:calc(100% - 160px); /* lässt Platz für die Minimap unten links */
  overflow-y:auto;
  overflow-x:hidden;
}

#unit-actions:empty{
  display:none;
}

.unit-action-btn{
  font-family:'VT323', monospace;
  font-size:17px;
  padding:8px 14px;
  background:rgba(28,39,64,0.9);
  border:2px solid var(--panel-border);
  color:var(--text);
  cursor:pointer;
  white-space:nowrap;
  box-shadow:0 2px 6px rgba(0,0,0,0.4);
}

.unit-action-btn:hover{
  border-color:var(--gold);
  background:#26335a;
}

.unit-action-btn.toggled{
  border-color:var(--gold);
  background:#3a4a1c;
  color:var(--gold);
}

/* ---------- BUILD PANEL / UNIT INFO ---------- */
#build-panel, #unit-info-panel{
  position:absolute;
  right:12px;
  top:12px;
  width:250px;
  max-height:calc(100% - 24px);
  display:flex;
  flex-direction:column;
  background:var(--panel);
  border:2px solid var(--gold);
  box-shadow:4px 4px 0 rgba(0,0,0,0.4);
  z-index:5;
  font-size:18px;
  overflow:hidden;
}

#unit-info-panel{
  width:600px;
  max-width:90vw;
}

#unit-info-panel table{
  display:block;
  overflow:auto;
  flex:1;
}

.build-panel-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:#1c2740;
  padding:8px 12px;
  font-family:'Press Start 2P', monospace;
  font-size:11px;
  color:var(--gold);
  flex:0 0 auto;
}

.build-panel-header button{
  background:none;
  border:none;
  color:var(--text);
  font-size:20px;
  cursor:pointer;
  line-height:1;
}

.build-panel-header button:hover{
  color:var(--ai);
}

#build-progress-label{
  padding:8px 12px 0 12px;
  color:#c8d0e0;
  font-size:17px;
}

#build-progress-wrap{
  margin:6px 12px;
  height:12px;
  background:#0a0e14;
  border:1px solid var(--panel-border);
}

#build-rally-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin:10px 12px 0 12px;
  padding-bottom:10px;
  border-bottom:1px solid var(--panel-border);
  font-size:15px;
  color:#8a93a8;
}

#build-rally-row button{
  font-family:'VT323', monospace;
  font-size:15px;
  padding:4px 10px;
  background:#1c2740;
  border:1px solid var(--panel-border);
  color:var(--text);
  cursor:pointer;
}

#build-rally-row button:hover{
  border-color:var(--gold);
}

#build-specialization-row{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
  margin:10px 12px 0 12px;
  padding-bottom:10px;
  border-bottom:1px solid var(--panel-border);
  font-size:15px;
}

.build-spec-label{
  color:#8a93a8;
  margin-right:auto;
}

.build-spec-btn{
  font-family:'VT323', monospace;
  font-size:15px;
  padding:4px 10px;
  background:#1c2740;
  border:1px solid var(--panel-border);
  color:var(--text);
  cursor:pointer;
}

.build-spec-btn:hover{
  border-color:var(--gold);
}

#build-progress-bar{
  height:100%;
  width:0%;
  background:var(--gold);
  transition:width 0.2s ease;
}

#build-options{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:10px 12px 12px 12px;
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
}

.build-option{
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:#1c2740;
  border:2px solid var(--panel-border);
  color:var(--text);
  padding:8px 10px;
  cursor:pointer;
  font-family:'VT323', monospace;
  font-size:17px;
  text-align:left;
}

.build-option:hover{
  border-color:var(--gold);
}

.build-option.active{
  border-color:var(--gold);
  background:#2a3a1c;
}

.build-option.disabled{
  opacity:0.4;
  cursor:not-allowed;
}
.build-option.disabled:hover{
  border-color:var(--panel-border);
}

.build-option .bo-name{
  color:var(--gold);
}

.build-option .bo-stats{
  color:#8a93a8;
  font-size:14px;
}

.build-option .bo-cost{
  color:var(--text);
  font-weight:bold;
}

#unit-info-table{
  width:100%;
  border-collapse:collapse;
  padding:10px 12px 14px 12px;
  font-size:15px;
}

#unit-info-table th, #unit-info-table td{
  padding:6px 10px;
  text-align:center;
  border-bottom:1px solid var(--panel-border);
}

#unit-info-table th{
  color:var(--gold);
  font-size:13px;
}

#unit-info-table td:first-child, #unit-info-table th:first-child{
  text-align:left;
}

/* ---------- GAME OVER ---------- */
#game-over, #save-load-panel{
  position:fixed;
  top:0; left:0; width:100%; height:100%;
  background:rgba(5,7,12,0.88);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:10;
  overflow-y:auto;
}

#save-load-panel .go-box{
  max-width:600px;
  width:90%;
}

#save-slots{
  display:flex;
  flex-direction:column;
  gap:14px;
  margin:10px 0 26px 0;
}

.save-slot{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  background:#1c2740;
  border:2px solid var(--panel-border);
  padding:14px 18px;
  text-align:left;
}

.save-slot-info{
  flex:1;
  min-width:0;
}

.save-slot-name{
  color:var(--gold);
  font-size:19px;
  display:block;
}

.save-slot-meta{
  color:#8a93a8;
  font-size:15px;
  display:block;
  margin-top:2px;
}

.save-slot-actions{
  display:flex;
  gap:8px;
  flex:0 0 auto;
}

.save-slot-actions button{
  font-family:'VT323', monospace;
  font-size:16px;
  padding:8px 14px;
  background:#141b2c;
  border:2px solid var(--panel-border);
  color:var(--text);
  cursor:pointer;
}

.save-slot-actions button:hover{
  border-color:var(--gold);
}

.save-slot-actions button:disabled{
  opacity:0.35;
  cursor:not-allowed;
}

#anim-speed-row{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:15px;
  color:#8a93a8;
  margin-top:4px;
}

.go-box{
  background:var(--panel);
  border:3px solid var(--gold);
  padding:40px 60px;
  text-align:center;
  box-shadow:0 0 40px rgba(224,184,74,0.3);
}

.go-box h2{
  font-family:'Press Start 2P', monospace;
  font-size:36px;
  color:var(--gold);
  margin:0 0 20px 0;
}

.go-box p{
  font-size:24px;
  color:var(--text);
  margin-bottom:26px;
}
