@font-face {
  font-family: 'C&C Red Alert [INET]';
  src: url('assets/font/C&C Red Alert [INET].ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --nova-vanguard-primary: #1E90FF;
  --pyre-legion-primary: #B22222;
  --font-base: 'C&C Red Alert [INET]', sans-serif;
  --font-heading: 'C&C Red Alert [INET]', sans-serif;
  --space: 8px;
  --border-color: #444;
  --metal-bg: #666;
  --metal-border: #999;
  --metal-highlight: #ccc;
  --metal-gradient: linear-gradient(145deg, #777, #555);
  --glow-color: #6cf;
  --score-border-color: #444;
  --progress-bg-color: #444;
}

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font-base);
}

.panel {
  display: flex;
  flex-direction: column;
  background: var(--metal-gradient);
  color: var(--metal-highlight);
}

/* Disable hover glow for game-side panels */
#right-panel.panel:hover,
#selected-units-panel.panel:hover {
  box-shadow: none;
}

.button-primary {
  padding: calc(var(--space) / 2) var(--space);
  border-radius: 4px;
  border: 1px solid var(--metal-border);
  cursor: url('/assets/mouse/default_pointer.png') 10 10, pointer;
  color: var(--metal-highlight);
  background: var(--metal-gradient);
}

.button-primary:hover {
  box-shadow: 0 0 6px var(--glow-color);
}

/* Disable button glow in the right panel */
#right-panel .button-primary:hover,
#right-panel .button-secondary:hover {
  box-shadow: none;
}

.button-primary.nova-vanguard {
  background: var(--nova-vanguard-primary);
}

.button-primary.pyre-legion {
  background: var(--pyre-legion-primary);
}

.button-secondary {
  padding: calc(var(--space) / 2) var(--space);
  border-radius: 4px;
  border: 1px solid var(--metal-border);
  background: var(--metal-gradient);
  color: var(--metal-highlight);
  cursor: url('/assets/mouse/default_pointer.png') 10 10, pointer;
}

.button-secondary:hover {
  box-shadow: 0 0 6px var(--glow-color);
}

#lobby-browser {
  display: flex;
  gap: var(--space);
  height: 70vh;
}

#lobby-main,
#chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#player-info-panel {
  width: 20%;
  padding: var(--space);
  font-family: var(--font-base);
}

#lobby-table-browser {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  font-family: var(--font-base);
}

#lobby-actions {
  display: flex;
  gap: var(--space);
  margin-bottom: var(--space);
}

#chat-container {
  position: static;
  height: auto;
  font-family: var(--font-base);
}

#chat-messages {
  flex-grow: 1;
  overflow-y: auto;
}

#chat-messages li {
  font-family: var(--font-base);
}

#lobby-chat-input {
  border-top: 1px solid var(--border-color);
  padding: 0.5rem;
}

/* ===== Game UI Styles ===== */

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: 'C&C Red Alert [INET]', sans-serif;
  background-color: var(--bg-dark);
  background-image: var(--bg-screen);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

h1,
h2 {
  font-family: var(--font-heading);
}

#game-ui {
  display: flex;
  height: 600px;
  position: relative;
}

#map-container {
  flex: 1;
}

#map-container canvas {
  cursor: inherit;
}

#narrator-panel {
  width: 150px;
  z-index: 9999;
  height: 150px;
  position: absolute;
  top: 0;
  left: 0;
  background: var(--bg-panel);
  border: 2px solid var(--border-metal);
  border-radius: var(--radius);
  box-shadow: inset 0 0 10px #000;
  color: var(--text-light);
  font-family: var(--font-body);
}

#wave-hud {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 4px 8px;
}
#wave-countdown {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 4px 8px;
}

#tech-tree-btn {
  position: absolute;
  top: 150px;
  left: 0;
  z-index: 9999;
}

#tech-tree-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 70%;
  overflow: auto;
  z-index: 1000;
}

#tech-tree-content {
  position: relative;
}


.tech-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: calc(var(--space) * 2);
}

.tech-node.has-children > .action-btn {
  margin-bottom: calc(var(--space) * 4);
}

.tech-children {
  display: flex;
  justify-content: center;
  gap: calc(var(--space) * 3);
}

.tech-node .action-btn {
  width: 100px;
  height: 100px;
}
.tech-node .action-btn.upgrade-btn {
  width: 80px;
  height: 80px;
}

.tree-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tree-lines path.highlight {
  stroke: yellow;
  stroke-width: 2px;
}

body.tech-tree-open #map-container,
body.tech-tree-open #right-panel,
body.tech-tree-open #narrator-panel,
body.tech-tree-open #selected-units-panel {
  filter: blur(2px);
}

#narrator-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#narrator-bubble {
  position: absolute;
  top: 0;
  left: 100%;
  margin-left: 8px;
  padding: 4px;
  background: var(--bg-panel);
  border: 2px solid var(--border-metal);
  border-radius: var(--radius);
  box-shadow: inset 0 0 10px #000;
  color: var(--text-light);
  font-family: var(--font-body);
  white-space: nowrap;
}

.selection-box {
  position: absolute;
  border: 0.5px solid #ffffff;
  background: rgba(255, 255, 255, 0.2);
  pointer-events: none;
}

#right-panel {
  width: 15%;
  min-width: 200px;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
}

body.mobile #right-panel {
  width: 30%;
}

#game-ui #right-panel .panel{
border:none;
  background: none;
}

#game-ui #right-panel .panel{
  padding:0px !important;
}
#power-bar-wrapper {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -16px;
  width: 16px;
  background: var(--progress-bg-color);
  border: 1px solid #000;
}

#power-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
}

.power-used,
.power-available,
.power-empty {
  position: absolute;
  left: 0;
  width: 100%;
  background-image: repeating-linear-gradient(
    to top,
    rgba(255, 255, 255, 0.15) 0,
    rgba(255, 255, 255, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
}

.power-used {
  background: #e04e4e;
  bottom: 0;
}

.power-available {
  background: #ffd700;
}

.power-empty {
  background: #2ecc71;
}

.power-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  color: #fff;
  font-size: 10px;
  pointer-events: none;
  white-space: nowrap;
  display: none;
}

.power-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  background-image: repeating-linear-gradient(
    to top,
    #000 0,
    #000 1px,
    transparent 1px,
    transparent calc(100% / 99)
  );
}

#production-info-panel {
  position: absolute;
  right: 100%;
  margin-right: 8px;
  width: 160px;
  background: var(--bg-panel);
  border: 2px solid var(--border-metal);
  border-radius: var(--radius);
  box-shadow: 0 0 6px var(--glow-color);
  color: var(--text-light);
  font-family: var(--font-body);
  padding: 4px;
  font-size: 12px;
  pointer-events: none;
}

#production-info-panel.hidden {
  display: none;
}

#production-info-panel .cost-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

#production-info-panel .cost-row img {
  width: 16px;
  height: 16px;
}

#power-info-panel {
  position: absolute;
  left: 100%;
  margin-left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 80px;
  text-align: center;
  background: var(--bg-panel);
  border: 2px solid var(--border-metal);
  border-radius: var(--radius);
  box-shadow: 0 0 6px var(--glow-color);
  color: var(--text-light);
  font-family: var(--font-body);
  padding: 4px;
  font-size: 12px;
  pointer-events: none;
}

#power-info-panel.hidden {
  display: none;
}

#action-info-panel {
  position: absolute;
  left: 100%;
  margin-left: 8px;
  width: 120px;
  background: var(--bg-panel);
  border: 2px solid var(--border-metal);
  border-radius: var(--radius);
  box-shadow: 0 0 6px var(--glow-color);
  color: var(--text-light);
  font-family: var(--font-body);
  padding: 4px;
  font-size: 12px;
  pointer-events: none;
}

#action-info-panel.hidden {
  display: none;
}

#upgrade-info-panel {
  position: absolute;
  left: 100%;
  margin-left: 8px;
  width: 160px;
  background: var(--bg-panel);
  border: 2px solid var(--border-metal);
  border-radius: var(--radius);
  box-shadow: 0 0 6px var(--glow-color);
  color: var(--text-light);
  font-family: var(--font-body);
  padding: 4px;
  font-size: 12px;
  pointer-events: none;
}

#upgrade-info-panel.hidden {
  display: none;
}

.upgrade-table {
  display: grid;
  grid-template-columns: repeat(5, 24px);
  gap: 4px;
  margin-top: 4px;
}

.upgrade-table img {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
}

/* inherit faction cursor inside the right panel */
#right-panel button,
#right-panel canvas,
#right-panel input {
  cursor: inherit;
}

#minimap-container {
  position: relative;
  width: 100%;
  padding-top: 100%;
  background: url('/assets/ui/minimapbackground.png') no-repeat;
  background-size: 100% 100%;
  box-sizing: border-box;
}

#minimap,
#minimap-overlay {
  position: absolute;
  top: 0%;
  left: 0%;
  width: 100%;
  height: 100%;
}

#minimap-overlay {
  pointer-events: none;
}

#minimap-cover {
      position: absolute;
    top: 20px;
    left: 20px;
    width: 82%;
    height: 82%;
    padding: 10px;
    background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.3s ease;
}

#minimap-cover img {
  width: 100%;
  height: auto;
}

#minimap-cover.slide-down {
  transform: translateY(100%);
}

#map-name {
  text-align: center;
  padding: var(--space);
  background: url('/assets/ui/mapnamebar.png') no-repeat;
  background-size: 100% 100%;
  color: var(--metal-highlight);
}

#resources {
  padding: var(--space);
  height: 60px;
  background: url('/assets/ui/resourcebar.png') no-repeat;
  background-size: 100% 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 4px;
}

#resources .resource-icon {
  width: 24px;
  height: 24px;
}

#tab-bar {
  height: 50px;
  background: url('/assets/ui/tabbarbackground.png') no-repeat;
  background-size: 100% 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#tab-bar button {
 

  color: var(--metal-highlight);
}

#tab-bar button:hover {
  box-shadow: 0 0 6px var(--glow-color);
}

#right-panel #tab-bar button:hover {
  box-shadow: 0 0 6px var(--glow-color);
}

#tab-bar button.active {
  background: var(--glow-color);
  color: #000;
}


#action-panels {
  position: relative;
  flex: 1;
  background: url('/assets/ui/constructionbar.png') no-repeat;
  background-size: 100% 100%;
}
#action-panels .panel {
  position: absolute;
  inset: 0;
  padding: 8px;
  overflow-y: auto;
}

#loading-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.7) var(--bg-screen);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

#loading-players {
  position: absolute;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 20px;
  color: #fff;
  font-size: 24px;
}

.loading-team {
  display: flex;
  gap: 20px;
}

.loading-player {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loading-faction-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 4px;
}


#loading-banner {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: #fff;
}

#loading-title {
  font-size: 48px;
}

#loading-banner .subtitle {
  font-size: 0.8em;
  color: #ccc;
}


#game-over {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

#pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space);
  z-index: 1000;
}

#pause-overlay button {
  padding: 8px 16px;
}

#disconnect-countdown {
  font-size: 24px;
  margin-top: var(--space);
}

#game-over ul {
  list-style: none;
  padding: 0;
  margin-top: 20px;
  font-size: 20px;
}
.player-ready {
  color: #87CEFA;
}

.player-not-ready {
  color: #FA8072;
}

#selected-units-panel {
  background: var(--bg-panel);
  border: 2px solid var(--border-metal);
  border-radius: var(--radius);
  box-shadow: inset 0 0 10px #000;
  color: var(--text-light);
  font-family: var(--font-body);
  padding: 8px;
  width:500px;
  height: 144px;
  position: absolute;
  z-index: 1000;
  bottom: 0;
  left: 0;
}

#selected-units-panel .action-table {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  grid-template-columns: repeat(5, 40px);
  grid-template-rows: repeat(3, 40px);
  gap: 4px;
}

#selected-units-panel .upgrade-progress-bar {
  position: absolute;
  left: 8px;
  bottom: 8px;
  width: 8px;
  height: 128px;
  border: 1px solid var(--border-metal);
  background: var(--progress-bg-color, #222);
  box-sizing: border-box;
}

#selected-units-panel .upgrade-progress-bar.hidden {
  display: none;
}

#selected-units-panel .upgrade-progress-bar .fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0%;
  background: var(--glow-color);
}

#selected-units-panel .action-cell button {
  width: 100%;
  height: 100%;
}
#selected-units-panel .action-cell button.active {
  background: var(--glow-color);
  color: #000;
}

body.mobile #selected-units-panel {
  width: 80px;
  height: 58px;
  padding: 4px;
  font-size: 12px;
}
#game-ui #right-panel #action-panels #units-panel,
#game-ui #right-panel #action-panels #buildings-panel,
#game-ui #right-panel #action-panels #upgrades-panel {
 padding:14px !important;
}

#upgrades-panel .centered-message {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  text-align: center;
  margin: 0;
}
body.mobile #selected-units-panel .unit-item,
body.mobile #selected-units-panel.single .single-unit {
  display: none;
}

body.mobile #selected-units-panel .unit-summary {
  display: none;
}

body.mobile #selected-units-panel.has-units .unit-summary {
  display: block;
}

body.mobile #selected-units-panel:not(.has-units) {
  display: none;
}

#rotate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  font-size: 20px;
}

#debug-display {
  background: var(--bg-panel);
  border: 2px solid var(--border-metal);
  border-radius: var(--radius);
  box-shadow: inset 0 0 10px #000;
  color: var(--text-light);
  font-family: var(--font-body);
  padding: 4px;
  height: 208px;
  position: absolute;
  bottom: 0;
  left: 500px;
  right: 15%;
  overflow-y: auto;
}

#debug-display #tab-bar {
  display: flex;
  margin-bottom: 4px;
}

#debug-display [data-panel].hidden {
  display: none;
}

/* use faction cursor for controls in selected units panel */
#selected-units-panel button,
#selected-units-panel input {
  cursor: inherit;
}

tr.selected {
  background: #333;
}


/* Subtitle styling for the home screen */
.subtitle {
  font-weight: normal;
  margin-top: -10px;
  margin-bottom: 20px;
  font-size: 1.2em;
  color: #ccc;
}

#connection-status {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 4px 8px;
  text-align: center;
  display: none;
  z-index: 1000;
}

.status-connected {
  background-color: #2e7d32;
}

.status-lost {
  background-color: #c62828;
}

.status-reconnecting {
  background-color: #ef6c00;
}


@keyframes press-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

#press-any-key {
  animation: press-pulse 2s infinite;
}

#title-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  text-align: center;
  background: linear-gradient(135deg, var(--metal-bg), var(--metal-highlight));
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  color: #fff;
  position: relative;
  overflow: hidden;
}



@keyframes grain {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-20%, 20%); }
}

#to-menu-btn {
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  background: var(--nova-vanguard-primary);
  color: #fff;
  cursor: url('/assets/mouse/default_pointer.png') 10 10, pointer;
}

#to-menu-btn:hover {
  background: #87CEFA;
}

/* Lobby list styling */
.nova-vanguard {
  border-left: 4px solid var(--nova-vanguard-primary);
  padding-left: 4px;
}

.pyre-legion {
  border-left: 4px solid var(--pyre-legion-primary);
  padding-left: 4px;
}

.player-host {
  font-weight: bold;
}

.player-color {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 4px;
  vertical-align: middle;
}
.faction-icon {
  width: 12px;
  height: 12px;
  vertical-align: middle;
  margin-right: 4px;
}

.hidden,
[hidden] {
  display: none !important;
}

/* Fade transition classes */
.fade-in,
.fade-out {
  transition: opacity 0.3s ease;
}

.fade-in {
  opacity: 1;
}

.fade-out {
  opacity: 0;
}

#join-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space);
}

#join-screen input,
#join-screen select,
#join-screen button {
  width: 200px;
  padding: 4px;
}

#progress-bar-container {
  width: 80%;
  height: 20px;
  background: var(--progress-bg-color);
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
}

#progress-bar {
  height: 100%;
  width: 0%;
  background: #0f0;
}
/* scoreboard results styling */
#scoreboard-results {
  list-style: none;
  padding: 0;
  margin: 0;
}

#scoreboard-results li {
  padding: 4px 8px;
  border-bottom: 1px solid var(--score-border-color);
}
#carbon-amount,
#population-amount,
#population-dash,
#population-cap,
#ore-amount{
  margin-top: 4px;
}

#scoreboard-results li:nth-child(odd) {
  background: rgba(255, 255, 255, 0.05);
}

.winner-nova-vanguard {
  color: var(--nova-vanguard-primary);
}

.winner-pyre-legion {
  color: var(--pyre-legion-primary);
}

#ready-controls {
  display: flex;
  gap: var(--space);
}

#scoreboard-results .faction-icon {
  width: 12px;
  height: 12px;
  vertical-align: text-bottom;
  margin-right: 4px;
}

#error-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--metal-bg);
  color: var(--metal-highlight);
  border: 1px solid var(--border-color);
  padding: var(--space);
  z-index: 1000;
}

#name-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--space);
  color: #fff;
  z-index: 1000;
}



.unit-icon {
  width: 32px;
  height: 32px;
  margin-right: 4px;
}

#selected-units-panel {
  padding-right: 220px;
  box-sizing: border-box;
}

#selected-units-panel .units-grid {
  display: grid;
  padding-right: 5px;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 2px;
  width: 100%;
  height: 100%;
}

#selected-units-panel .unit-item {
  position: relative;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

#selected-units-panel .unit-item .unit-count {
  text-align: center;
  font-size: 10px;
  line-height: 10px;
}

#selected-units-panel .unit-item img.unit-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#selected-units-panel .unit-name {
  font-size: 12px;
}

#selected-units-panel .unit-rank {
  position: absolute;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
}

#selected-units-panel.single .single-unit {
  display: flex;
  align-items: center;
}

#selected-units-panel.single .portrait {
  position: relative;
  margin-right: 8px;
}

#selected-units-panel.single .portrait img {
  width: 64px;
  height: 64px;
}

#selected-units-panel.single .portrait .health-bar {
  position: absolute;
  top: calc(100% + 2px);
  bottom: auto;
  left: 0;
  right: 0;
}

#selected-units-panel.single .portrait .unit-rank {
  width: 24px;
  height: 24px;
  top: 0;
  right: 0;
}

#selected-units-panel.single .unit-thought {
  font-style: italic;
  margin-top: 4px;
}

#selected-units-panel .health-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border: 1px solid #000;
  background: #ff0000;
  overflow: hidden;
}

#selected-units-panel .health-bar .fill {
  height: 100%;
  width: 0;
}

@keyframes queue-pulse {
  0%, 100% {
    background: rgba(255, 255, 255, 0.1);
  }
  50% {
    background: rgba(255, 255, 255, 0.3);
  }
}

.queue-slot {
  animation: queue-pulse 1s infinite;
  list-style: none;
  border-bottom: 1px solid var(--metal-border);
  padding: 2px 4px;
}

/* ---------- GAME ROOM STYLING ---------- */

#gameroom {
  display: flex;
  flex-direction: column;
  padding: var(--spacing);
  border: 2px solid var(--border-metal);
  box-shadow: inset 0 0 12px #000;
  color: var(--text-light);
  font-family: var(--font-body);
  height: 100%;
  overflow: hidden;
}

/* Padding for all panels within the gameroom */
#gameroom .panel {
  padding: var(--spacing);
}

/* Title + Leave */
#gameroom #gameroom-title {
  font-family: var(--font-heading);
  font-size: 1.6em;
  color: var(--highlight-red);
  text-shadow: 0 0 6px var(--glow-red);
  margin: 0 0 var(--spacing) 0;
  text-align: center;
}


/* Ready Controls */
#ready-controls {
  display: flex;
  gap: var(--spacing);
  justify-content: center;
  margin-bottom: var(--spacing);
}
#ready-controls button {
  padding: 6px 12px;
  font-family: var(--font-heading);
  border: 2px solid var(--border-metal);
  background: var(--panel-metal);
  position: relative;
  transition: all .2s;
}
#ready-controls button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glow-red);
  opacity: 0;
  transition: .2s;
}
#ready-controls button:hover::after {
  opacity: .3;
}
#ready-controls .hidden {
  display: none;
}

/* Player List */
#gameroom p + ul#players {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--spacing) 0;
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--border-metal);
  background: #111;
}
#gameroom #players li {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-metal);
  display: flex;
  align-items: center;
}
#gameroom #players li:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}

#gameroom #players li .team-select {
  margin-left: auto;
}

#gameroom #players .team-select {
  padding: 4px;
  border: 2px solid var(--border-metal);
  background: #000;
  color: var(--text-light);
}

/* Settings Panel */
#gameroom #settings,
#gameroom #player-settings,
#gameroom #map-settings {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing);
  align-items: center;
  padding: var(--spacing);
  background: #111;
  border: 1px solid var(--border-metal);
  margin-bottom: var(--spacing);
}
#gameroom #settings select,
#gameroom #settings input[type="number"],
#gameroom #player-settings select,
#gameroom #player-settings input[type="number"],
#gameroom #map-settings select,
#gameroom #map-settings input[type="number"] {
  padding: 4px;
  border: 2px solid var(--border-metal);
  background: #000;
  color: var(--text-light);
}
#gameroom #settings label,
#gameroom #player-settings label,
#gameroom #map-settings label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9em;
}
#gameroom #settings-btn {
  margin-left: auto;
}

/* Chat Sub-Panel */
#gameroom #chat {
  display: flex;
  flex-direction: column;
  background: #111;
  border: 1px solid var(--border-metal);
  padding: var(--spacing);
  flex: 1;
  margin-bottom: var(--spacing);
}
#gameroom #messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: var(--spacing);
}
#gameroom #chat-input {
  padding: 6px;
  border: 2px solid var(--border-metal);
  background: #000;
  color: var(--text-light);
  width: calc(100% - 80px);
  margin-right: var(--spacing);
}
#gameroom #send-btn {
  padding: 6px 12px;
  border: 2px solid var(--border-metal);
  background: var(--panel-metal);
  font-family: var(--font-heading);
  position: relative;
}
#gameroom #send-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glow-red);
  opacity: 0;
  transition: .2s;
}
#gameroom #send-btn:hover::after {
  opacity: .3;
}

/* Start Button & Status */
#gameroom #start-btn {
  align-self: center;
  padding: 8px 16px;
  font-family: var(--font-heading);
  border: 2px solid var(--border-metal);
  background: var(--panel-metal);
  position: relative;
  transition: all .2s;
}
#gameroom #start-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glow-red);
  opacity: 0;
  transition: .2s;
}
#gameroom #start-btn:hover::after {
  opacity: .3;
}
#gameroom #start-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}
#gameroom #status {
  text-align: center;
  font-style: italic;
  opacity: 0.8;
}

/* cursors for unit commands */
.cursor-red-circle {
  cursor: url('/assets/mouse/attack.png') 10 10, auto;
}

.cursor-green-circle {
  cursor: url('/assets/mouse/move.png') 10 10, auto;
}

.cursor-gold-circle {
  cursor: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PGNpcmNsZSBjeD0iOCIgY3k9IjgiIHI9IjUiIGZpbGw9IiNGRkQ3MDAiLz48L3N2Zz4=") 38 38, auto;
}

.cursor-square {
  cursor: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz1odHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiPjxyZWN0IHg9IjEiIHk9IjEiIHdpZHRoPSIxNCIgaGVpZ2h0PSIxNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9zdmc+") 38 38, auto;
}

.cursor-default {
  cursor: url('/assets/mouse/default_pointer.png') 10 10, auto;
}

.cursor-nova-vanguard {
  cursor: url('/assets/mouse/nova_vanguard_pointer.png') 10 10, auto;
}

.cursor-pyre-legion {
  cursor: url('/assets/mouse/pyre_legion_pointer.png') 10 10, auto;
}

.cursor-select {
  cursor: url('/assets/mouse/select.png') 10 10, auto;
}

.cursor-waypoint {
  cursor: url('/assets/mouse/waypoint.png') 10 10, auto;
}

.cursor-axe {
  cursor: url('/assets/mouse/axe.png') 10 10, auto;
}

.cursor-pickaxe {
  cursor: url('/assets/mouse/pickaxe.png') 10 10, auto;
}


/* ---------- THEME VARIABLES ---------- */
:root {
  --bg-dark: #0a0a0a;
  --bg-map: url('/assets/background.png');
  --bg-screen: var(--bg-map);
  --panel-metal: linear-gradient(145deg, #1a1a1a, #111111);
  --border-metal: #333;
  --highlight-red: #C62828;
  --glow-red: rgba(198, 40, 40, 0.6);
  --text-light: #e0e0e0;
  --font-heading: 'C&C Red Alert [INET]', sans-serif;
  --font-body: 'C&C Red Alert [INET]', sans-serif;
  --spacing: 8px;
}

/* ---------- BASE LAYOUT ---------- */
#lobby-browser {
  display: flex;
  flex-direction: column;
  height: 100vh;
  color: var(--text-light);
  font-family: var(--font-body);
}

/* Header */
#lobby-header {
  text-align: center;
  padding: var(--spacing);
}
#lobby-header .title {
  font-family: var(--font-heading);
  font-size: 1.8em;
  color: var(--highlight-red);
  text-shadow: 0 0 8px var(--glow-red);
  margin: 0;
}
#lobby-header .subtitle {
  font-size: 1em;
  opacity: 0.7;
  margin-top: 4px;
}

/* Action Buttons */
#lobby-actions {
  display: flex;
  justify-content: center;
  gap: var(--spacing);
  margin: var(--spacing) 0;
}
.btn {
  padding: 8px 16px;
  border: 2px solid var(--border-metal);
  background: var(--panel-metal);
  color: var(--text-light);
  font-family: var(--font-heading);
  cursor: url('/assets/mouse/default_pointer.png') 10 10, pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glow-red);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.btn:hover::after {
  opacity: 0.3;
}
.btn-primary {
  border-color: var(--highlight-red);
}
.btn-secondary {
  border-color: #555;
  color: #aaa;
}

/* Table Panel */
#lobby-table-browser {
  flex: 1;
  margin: 0 var(--spacing);
  background: var(--panel-metal);
  border: 2px solid var(--border-metal);
  overflow: auto;
  box-shadow: inset 0 0 10px #000;
}
#browser-room-table {
  width: 100%;
  border-collapse: collapse;
}
#browser-room-table th,
#browser-room-table td {
  padding: 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-metal);
}
#browser-room-table thead {
  background: #111;
}
#browser-room-table tbody tr:hover {
  background: rgba(198, 40, 40, 0.2);
}
#browser-room-table tbody tr.selected {
  background: rgba(198, 40, 40, 0.5);
  box-shadow: inset 0 0 8px var(--glow-red);
}

/* Custom scrollbar */
#lobby-table-browser::-webkit-scrollbar {
  width: 8px;
}
#lobby-table-browser::-webkit-scrollbar-track {
  background: #111;
}
#lobby-table-browser::-webkit-scrollbar-thumb {
  background: var(--highlight-red);
  border-radius: 4px;
  box-shadow: 0 0 4px var(--glow-red);
}

/* Chat Panel */
#chat-container {
  display: flex;
  flex-direction: column;
  background: #111;
  border-top: 2px solid var(--border-metal);
  padding: var(--spacing);
  height: 200px;
}
#chat-messages {
  flex: 1;
  list-style: none;
  padding: 0;
  margin: 0 0 var(--spacing) 0;
  overflow-y: auto;
}
#chat-messages li {
  margin-bottom: 4px;
  line-height: 1.2;
}
#lobby-chat-input {
  padding: 6px;
  border: 2px solid var(--border-metal);
  background: #000;
  color: var(--text-light);
  font-size: 1em;
  outline: none;
  width: 100%;
}

/* Disabled join button */
#join-room-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Disabled blur utility */
.disabled-blur {
  filter: blur(3px);
  pointer-events: none;
}

/* Fade in/out utility */
.fade-in { opacity: 1; transition: opacity 0.3s ease; }
.fade-out { opacity: 0; transition: opacity 0.3s ease; }

/* ---------- TITLE SCREEN ---------- */
#title-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg-dark);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  color: var(--text-light);
  font-family: var(--font-heading);
  position: relative;
  overflow: hidden;
}

/* Subtle world-map background */
#title-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-dark) var(--bg-screen);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0.1;
  pointer-events: none;
}

/* Game logo */
#game-logo {
  max-width: 500px;
  margin-bottom: var(--spacing);
  filter: drop-shadow(0 0 8px var(--glow-red));
}

/* Main heading */
#title-screen h1 {
  font-size: 3em;
  margin: 0;
  color: var(--highlight-red);
  text-shadow: 0 0 12px var(--glow-red);
}

/* Credits under title */
#title-screen .subtitle {
  font-family: var(--font-body);
  font-size: 1.2em;
  color: #aaa;
  margin: 8px 0 24px;
}

/* Press-any-key prompt */
#press-any-key {
  font-family: var(--font-body);
  font-size: 1em;
  padding: 8px 16px;
  border: 2px solid var(--border-metal);
  background: var(--panel-metal);
  position: relative;
  animation: press-pulse 1.8s infinite;
}
#press-any-key::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glow-red);
  opacity: 0;
  transition: opacity .2s;
}
#press-any-key:hover::after {
  opacity: .3;
}


/* ---------- MAIN MENU ---------- */
#main-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 15vh;
  height: 100vh;
  background: var(--bg-dark) var(--bg-screen) center/cover no-repeat;
  font-family: var(--font-heading);
  position: relative;
  color: var(--text-light);
}


#main-menu-logo {
  max-width: 400px;
  margin-bottom: var(--spacing);
  filter: drop-shadow(0 0 8px var(--glow-red));
}

#main-menu .btn {
  margin-top: var(--spacing);
}

#menu-panel {
  width: 400px;
  max-width: 90%;
  border: 2px solid var(--border-metal);
  background: var(--panel-metal);
  padding: var(--space);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

#menu-panel .btn {
  width: 100%;
}

#support-links {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

#support-links img {
  width: 120px;
  height: auto;
}

#game-version {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-family: var(--font-body);
  font-size: 0.8em;
  color: #aaa;
}

#version-panel {
  max-width: 600px;
  border: 2px solid var(--border-metal);
  background: var(--panel-metal);
  padding: var(--space);
  margin-bottom: var(--space);
  text-align: center;
}

#version-panel .version-number {
  font-family: var(--font-heading);
  font-size: 1.4em;
  margin-bottom: var(--space);
  color: var(--metal-highlight);
}

#version-panel .version-desc {
  font-family: var(--font-body);
  font-size: 1em;
  color: var(--metal-highlight);
}

/* ---------- MODALS (Name & New-Room) ---------- */
#name-modal,
#join-room-modal,
#join-ip-modal,
#show-ip-modal,
#options-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel-metal);
  border: 2px solid var(--border-metal);
  box-shadow: 0 0 16px #000;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: var(--spacing);
  z-index: 1000;
  width: 480px;
  text-align: center;
}

#options-modal {
  z-index: 1100;
}

/* Input fields in modals */
#name-modal input,
#join-ip-modal input,
#options-modal input {
  padding: 8px;
  border: 2px solid var(--border-metal);
  background: #000;
  color: var(--text-light);
  font-size: 1em;
  outline: none;
}

/* Align option labels with their inputs */
#options-modal label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#options-modal label input,
#options-modal label select {
  flex: 1 0 auto;
  margin-left: var(--spacing);
}

/* Modal buttons */
#name-confirm,
#join-room-confirm,
#ip-connect-btn,
#ip-close-btn,
#options-close {
  align-self: center;
  padding: 8px 16px;
  font-family: var(--font-heading);
  border: 2px solid var(--highlight-red);
  background: var(--panel-metal);
  color: var(--text-light);
  position: relative;
  transition: all .2s;
}
#name-confirm::after,
#join-room-confirm::after,
#ip-connect-btn::after,
#ip-close-btn::after,
#options-close::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glow-red);
  opacity: 0;
  transition: opacity .2s;
}
#name-confirm:hover::after,
#join-room-confirm:hover::after,
#ip-connect-btn:hover::after,
#ip-close-btn:hover::after,
#options-close:hover::after {
  opacity: .3;
}

#room-create-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.modal-desc {
  margin: 0;
  font-size: 0.9em;
}

#join-faction-options {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--spacing);
}
#join-faction-options button {
  position: relative;
  background: transparent;
  border: 2px solid var(--border-metal);
  padding: 4px;
  cursor: url('/assets/mouse/default_pointer.png') 10 10, pointer;
}
#join-faction-options button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#join-faction-options button.disabled::before {
  content: '✖';
  color: red;
  position: absolute;
  left: 2px;
  top: 2px;
}
#join-faction-options button .coming-soon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8em;
  color: white;
}
#join-faction-options button .faction-option {
  display: flex;
  flex-direction: column;
  align-items: center;
}
#join-faction-options button .faction-option span {
  margin-top: 4px;
  text-transform: capitalize;
  font-size: 0.9em;
  color: var(--text-light);
}
#join-faction-options button.selected {
  border-color: var(--highlight-red);
}
#join-faction-options img {
  width: 64px;
  height: 64px;
}

#join-faction-options button.disabled img {
  filter: blur(3px);
}

.action-btn.disabled-blur {
  filter: blur(2px);
  cursor: not-allowed;
  opacity: 0.5;
}

.action-btn .coming-soon-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8em;
  color: white;
  pointer-events: none;
}


/* ---------- GAME ROOM STYLING ---------- */

#gameroom {
  display: flex;
  flex-direction: column;
  padding: var(--spacing);
  border: 2px solid var(--border-metal);
  box-shadow: inset 0 0 12px #000;
  color: var(--text-light);
  font-family: var(--font-body);
  height: 100%;
  overflow: hidden;
}

/* Title + Leave */
#gameroom #gameroom-title {
  font-family: var(--font-heading);
  font-size: 1.6em;
  color: var(--highlight-red);
  text-shadow: 0 0 6px var(--glow-red);
  margin: 0 0 var(--spacing) 0;
  text-align: center;
}

/* Ready Controls */
#ready-controls {
  display: flex;
  gap: var(--spacing);
  justify-content: center;
  margin-bottom: var(--spacing);
}
#ready-controls button {
  /* reuse btn style */
  padding: 6px 12px;
  font-family: var(--font-heading);
  border: 2px solid var(--border-metal);
  background: var(--panel-metal);
  position: relative;
  transition: all .2s;
}
#ready-controls button::after {
  content:'';
  position:absolute; inset:0;
  background:var(--glow-red);
  opacity:0; transition:.2s;
}
#ready-controls button:hover::after { opacity:.3; }
#ready-controls .hidden { display: none; }

/* Player List */
#gameroom p + ul#players {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--spacing) 0;
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--border-metal);
  background: #111;
}
#gameroom #players li {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-metal);
}
#gameroom #players li:nth-child(odd) {
  background: rgba(255,255,255,0.03);
}

/* Settings Panel */
#gameroom #settings,
#gameroom #player-settings,
#gameroom #map-settings {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing);
  align-items: center;
  padding: var(--spacing);
  background: #111;
  border: 1px solid var(--border-metal);
  margin-bottom: var(--spacing);
}
#gameroom #settings select,
#gameroom #settings input[type="number"],
#gameroom #player-settings select,
#gameroom #player-settings input[type="number"],
#gameroom #map-settings select,
#gameroom #map-settings input[type="number"] {
  padding: 4px;
  border: 2px solid var(--border-metal);
  background: #000;
  color: var(--text-light);
}
#gameroom #settings label,
#gameroom #player-settings label,
#gameroom #map-settings label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9em;
}
#gamer­oom #settings-btn {
  margin-left: auto;
}

/* Chat Sub-Panel */
#gameroom #chat {
  display: flex;
  flex-direction: column;
  background: #111;
  border: 1px solid var(--border-metal);
  padding: var(--spacing);
  flex: 1;
  margin-bottom: var(--spacing);
}
#gameroom #messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: var(--spacing);
}
#gameroom #chat-input {
  padding: 6px;
  border: 2px solid var(--border-metal);
  background: #000;
  color: var(--text-light);
  width: calc(100% - 80px);
  margin-right: var(--spacing);
}
#gameroom #send-btn {
  padding: 6px 12px;
  border: 2px solid var(--border-metal);
  background: var(--panel-metal);
  font-family: var(--font-heading);
  position: relative;
}
#gameroom #send-btn::after {
  content:'';
  position:absolute; inset:0;
  background:var(--glow-red);
  opacity:0; transition:.2s;
}
#gameroom #send-btn:hover::after { opacity:.3; }

/* Start Button & Status */
#gameroom #start-btn {
  padding: 8px 16px;
  font-family: var(--font-heading);
  border: 2px solid var(--border-metal);
  background: var(--panel-metal);
  position: relative;
  transition: all .2s;
}
#gameroom #start-btn::after {
  content:'';
  position:absolute; inset:0;
  background:var(--glow-red);
  opacity:0; transition:.2s;
}
#gameroom #start-btn:hover::after { opacity:.3; }
#gameroom #start-btn:disabled { opacity:.4; cursor: not-allowed; }
#gameroom #status {
  text-align: center;
  font-style: italic;
  opacity: 0.8;
}

#gameroom #minimap-canvas {
  position: relative;
  width: 100%;
  padding-top: 100%;
  background: #000;
  border: 1px solid var(--border-metal);
  box-sizing: border-box;
}

#gameroom #minimap-canvas canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Grid of available actions */
.action-grid {
  width: 100%;
  table-layout: fixed;
}

.action-grid td {
  width: 40%;
}

.action-grid .action-btn {
  width:100%;
  height: 100px;
}

.action-btn {
  position: relative;
  overflow: hidden;
  width: calc(var(--space) * 4);
  height: calc(var(--space) * 4);
  border: 1px solid var(--metal-border);
  background: var(--metal-gradient);
  color: var(--metal-highlight);
}

.unit-btn {
  background-size: 100% auto;
  background-position: center;
  background-repeat: no-repeat;
}

.building-btn {
  background-size: 100% auto;
  background-position: center;
  background-repeat: no-repeat;
}

.upgrade-btn {
  background-size: 100% auto;
  background-position: center;
  background-repeat: no-repeat;
}

.action-btn.unit-btn {
  border-color: #0077cc;
}

.action-btn.building-btn {
  border-color: #cc5555;
}

.action-btn.upgrade-btn {
  border-color: #d4a017;
}

.action-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glow-color);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.action-btn:hover::after {
  opacity: 0.3;
}

.action-btn:active::after {
  opacity: 0.6;
}

.action-btn.flash-red {
  animation: flash-red 0.3s ease-in-out;
}

.flash-notify {
  animation: flash-notify 0.8s ease-in-out;
}

.action-btn.low-power::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glow-red);
  opacity: 0.4;
  pointer-events: none;
}

.action-btn.low-power {
  cursor: not-allowed;
}

@keyframes flash-red {
  0%, 100% { background: var(--metal-gradient); }
  50% { background: var(--accent-red); }
}

@keyframes flash-notify {
  0%, 100% { background: var(--metal-gradient); }
  50% { background: var(--glow-color); }
}

.action-btn .progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  --progress: 0deg;
  background: conic-gradient(
      var(--glow-color) var(--progress),
      transparent 0deg
    );
  mask-image: radial-gradient(farthest-side, black 99%, transparent 100%);
  opacity: 0.6;
  pointer-events: none;
  transition: background 0.3s ease;
}

@property --progress {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes production-progress {
  from { --progress: 0deg; }
  to { --progress: 360deg; }
}

.action-btn .progress-fill.running {
  animation: production-progress var(--duration) linear forwards;
}

.action-btn .name-label {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  pointer-events: none;
  color: var(--metal-highlight);
}

.action-btn .type-label {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  pointer-events: none;
  color: var(--metal-highlight);
}

.action-btn .queue-count {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  pointer-events: none;
  color: var(--metal-highlight);
}

.action-btn .ore-cost-label {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 12px;
  pointer-events: none;
  color: var(--metal-highlight);
  display: flex;
  align-items: center;
  gap: 2px;
}

.action-btn .carbon-cost-label {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 12px;
  pointer-events: none;
  color: var(--metal-highlight);
  display: flex;
  align-items: center;
  gap: 2px;
}

.action-btn .cost-icon {
  width: 16px;
  height: 16px;
}

.meta-row {
  padding: calc(var(--space) * 2);
  margin-bottom: calc(var(--space) * 4);
}

.meta-row.meta-1 {
  background: rgba(50, 50, 50, 0.3);
}

.meta-row.meta-2 {
  background: rgba(80, 80, 80, 0.3);
}

.meta-row.meta-3 {
  background: rgba(110, 110, 110, 0.3);
}

.meta-row .meta-label {
  font-weight: bold;
  margin-bottom: calc(var(--space) * 1);
}


  /* ---------- VARIABLES & RESET ---------- */
    :root {
      --bg-dark: #111;
      --bg-panel: #1f1f1f;
      --accent-red: #e04e4e;
      --accent-hover: rgba(224, 78, 78, 0.2);
      --text-light: #eee;
      --text-muted: #aaa;
      --radius: 6px;
      --gap: 12px;
      --font-heading: 'C&C Red Alert [INET]', sans-serif;
      --font-body: 'C&C Red Alert [INET]', sans-serif;
    }
    * { margin: 0; padding: 0; box-sizing: border-box; }
    body, html { height: 100%; background: var(--bg-dark); color: var(--text-light); font-family: var(--font-body);    background-position: center;
  background-size: cover;
  background-repeat: no-repeat;}

  body{
        background-position: center !important;
  background-size: cover !important;
  background-repeat: no-repeat !important;
  }
    /* ---------- LAYOUT ---------- */
    .lobby {
      display: flex;
      flex-direction: column;
      height: 100%;
      padding: var(--gap);
      gap: var(--gap);
    }
    .lobby__header {
      text-align: center;
    }
    .lobby__title {
      font-family: var(--font-heading);
      font-size: 1.8rem;
      color: var(--accent-red);
      text-shadow: 0 0 6px rgba(224,78,78,0.6);
    }
    .lobby__subtitle {
      font-size: 0.95rem;
      color: var(--text-muted);
      margin-top: 4px;
    }

    .lobby__controls {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: var(--gap);
    }
    .lobby__controls-left { display: flex; gap: var(--gap); }
    .btn {
      padding: 8px 16px;
      border: 2px solid var(--accent-red);
      background: var(--bg-panel);
      color: var(--text-light);
      font-family: var(--font-heading);
      border-radius: var(--radius);
      cursor: pointer;
      position: relative;
      overflow: hidden;
      transition: background 0.2s;
    }
    .btn:hover {
      background: var(--accent-hover);
    }
    .btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }

    /* ---------- MAIN PANELS ---------- */
    .lobby__main {
      flex: 1;
      display: flex;
      gap: var(--gap);
      overflow: hidden;
    }
    .panel {
  
      box-shadow: inset 0 0 10px #000;
    }
    .panel--sidebar {
      flex: 0 0 400px;
      display: flex;
      flex-direction: column;
      gap: var(--gap);
    }
    #gameroom.singleplayer .minimap.panel--sidebar {
      flex: 0 0 600px;
    }
    .panel--chat {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: var(--gap);
    }

    /* ---------- PLAYER LIST ---------- */
    .players {
      flex: 1;
      overflow-y: auto;
      list-style: none;
      border: 1px solid #333;
      border-radius: var(--radius);
    }
    .players__item {
      padding: 8px;
      border-bottom: 1px solid #333;
      display: flex;
      align-items: center;
    }
    .players__item:nth-child(odd) {
      background: rgba(255,255,255,0.05);
    }
    .players__item.host {
      font-weight: bold;
      color: var(--accent-red);
    }

    .players__item .team-select {
      margin-left: auto;
    }

    .players .team-select {
      flex: 0 0 auto;
      padding: 6px;
      background: #000;
      color: var(--text-light);
      border: 1px solid #333;
      border-radius: var(--radius);
    }

    /* ---------- SETTINGS ---------- */
    #settings,
    #player-settings,
    #map-settings {
      display: flex;
      gap: var(--gap);
      flex-wrap: wrap;
    }
    #settings select,
    #player-settings select,
    #map-settings select {
      flex: 1;
      padding: 6px;
      background: #000;
      color: var(--text-light);
      border: 1px solid #333;
      border-radius: var(--radius);
    }

    /* ---------- CHAT ---------- */
    .chat__messages {
      flex: 1;
      overflow-y: auto;
      padding: 8px;
      background: #000;
      border: 1px solid #333;
      border-radius: var(--radius);
      font-size: 0.9rem;
      line-height: 1.4;
    }
    .chat__input-group {
      display: flex;
      gap: var(--gap);
    }
    .chat__input {
      flex: 1;
      padding: 8px;
      background: #000;
      color: var(--text-light);
      border: 1px solid #333;
      border-radius: var(--radius);
      font-size: 0.95rem;
      outline: none;
    }

    /* ---------- FOOTER ---------- */
    .lobby__footer {
      text-align: center;
      display: flex;
      flex-direction: column;
      gap: var(--gap);
    }
    .status {
      font-size: 0.9rem;
      color: var(--text-muted);
      font-style: italic;
    }

    /* ---------- RESPONSIVE ---------- */
    @media (max-width: 768px) {
      .lobby__main {
        flex-direction: column;
      }
      .panel--sidebar {
        flex: none;
        order: 2;
      }
      .panel--chat {
        order: 1;
      }
    }

    /* ---------- VARIABLES & RESET ---------- */
    :root {
      --bg-dark: #111;
      --bg-panel: #1f1f1f;
      --accent-red: #e04e4e;
      --accent-hover: rgba(224, 78, 78, 0.2);
      --text-light: #eee;
      --text-muted: #aaa;
      --radius: 6px;
      --gap: 12px;
      --font-heading: 'C&C Red Alert [INET]', sans-serif;
      --font-body: 'C&C Red Alert [INET]', sans-serif;
    }
    * { margin: 0; padding: 0; box-sizing: border-box; }
    body, html { height: 100%; background: var(--bg-dark); color: var(--text-light); font-family: var(--font-body); }

    /* ---------- LAYOUT ---------- */
    #lobby-browser {
      display: flex;
      flex-direction: column;
      height: 100%;
      padding: var(--gap);
      gap: var(--gap);
      overflow: hidden;
    }
    .hidden { display: none !important; }

    /* ---------- HEADER ---------- */
    #lobby-header {
      text-align: center;
    }
    #lobby-header .title {
      font-family: var(--font-heading);
      font-size: 1.8rem;
      color: var(--accent-red);
      text-shadow: 0 0 6px rgba(224,78,78,0.6);
    }
    #lobby-header .subtitle {
      font-size: 0.95rem;
      color: var(--text-muted);
      margin-top: 4px;
    }

    /* ---------- ACTION BUTTONS ---------- */
    #lobby-actions {
      display: flex;
      justify-content: center;
      gap: var(--gap);
    }
    .btn {
      padding: 8px 16px;
      border: 2px solid var(--accent-red);
      background: var(--bg-panel);
      color: var(--text-light);
      font-family: var(--font-heading);
      border-radius: var(--radius);
      cursor: pointer;
      transition: background 0.2s;
    }
    .btn:hover:not(:disabled) {
      background: var(--accent-hover);
    }
    .btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }
    .btn.btn-secondary {
      border-color: #555;
      color: var(--text-muted);
    }

    /* ---------- TABLE PANEL ---------- */
    #lobby-table-browser {
      flex: 1;
      background: var(--bg-panel);
      border: 2px solid #333;
      border-radius: var(--radius);
      overflow: auto;
      box-shadow: inset 0 0 10px #000;
    }
    #browser-room-table {
      width: 100%;
      border-collapse: collapse;
    }
    #browser-room-table th,
    #browser-room-table td {
      padding: 12px;
      text-align: left;
      border-bottom: 1px solid #333;
      font-size: 0.95rem;
    }
    #browser-room-table thead {
      background: #222;
    }
    #browser-room-table tbody tr:hover {
      background: rgba(224,78,78,0.2);
    }
    #browser-room-table tbody tr.selected {
      background: rgba(224,78,78,0.5);
      box-shadow: inset 0 0 6px rgba(224,78,78,0.6);
    }
    /* custom scrollbar */
    #lobby-table-browser::-webkit-scrollbar {
      width: 8px;
    }
    #lobby-table-browser::-webkit-scrollbar-track {
      background: #222;
    }
    #lobby-table-browser::-webkit-scrollbar-thumb {
      background: var(--accent-red);
      border-radius: 4px;
      box-shadow: 0 0 4px rgba(224,78,78,0.6);
    }

    /* ---------- CHAT PANEL ---------- */
    #chat-container {
      display: flex;
      flex-direction: column;
      gap: var(--gap);
      background: var(--bg-panel);
      border: 2px solid #333;
      border-radius: var(--radius);
      padding: var(--gap);
      max-height: 200px;
    }
    #chat-messages {
      flex: 1;
      overflow-y: auto;
      list-style: none;
      padding: 8px;
      background: #000;
      border: 1px solid #333;
      border-radius: var(--radius);
      font-size: 0.9rem;
      line-height: 1.4;
    }
    #chat-messages li {
      margin-bottom: 6px;
    }
    #lobby-chat-input {
      padding: 8px;
      background: #000;
      color: var(--text-light);
      border: 1px solid #333;
      border-radius: var(--radius);
      font-size: 0.95rem;
      outline: none;
      width: 100%;
    }

    /* ---------- RESPONSIVE ---------- */
    @media (max-width: 768px) {
      #lobby-table-browser { max-height: 240px; }
      #chat-container { max-height: 160px; }
    }

/* Simple loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 4px solid #555;
  border-top-color: var(--highlight-red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== Level Editor Styles ===== */

button.selected {
  border: 2px solid #2196f3;
  background-color: #e0f7fa;
}

/* Mirror shared theme styles so the editor matches the main game */

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font-base);
}

.panel {
  display: flex;
  flex-direction: column;
  background: #222;
  color: #fff;
}

.button-primary {
  padding: calc(var(--space) / 2) var(--space);
  border-radius: 4px;
  border: none;
  cursor: url('/assets/mouse/default_pointer.png') 10 10, pointer;
  color: #fff;
}

.button-primary.nova-vanguard {
  background: var(--nova-vanguard-primary);
}

.button-primary.pyre-legion {
  background: var(--pyre-legion-primary);
}

.button-secondary {
  padding: calc(var(--space) / 2) var(--space);
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: #fff;
  cursor: url('/assets/mouse/default_pointer.png') 10 10, pointer;
}
.mode-rules { margin-top: var(--space); color: var(--text-light); }

/* ---------- LOBBY BROWSER LAYOUT ---------- */
#lobby-browser {
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space);
  max-width: 1000px;
}

#lobby-main,
#chat-container {
  width: 100%;
}

/* ---------- GAMEROOM LAYOUT ---------- */
.lobby__main {
  width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  max-width: 1200px;
}

.lobby__main > .panel--chat {
  grid-column: 1 / span 3;
  flex: none;
}
