/* base */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  background: #2b2b2b;
  color: #eee;
}

#loginScreen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  color: #fff;
}
#loginScreen input {
  padding: 8px;
  margin: 5px;
  width: 220px;
  box-sizing: border-box;
  border: 1px solid #777;
  border-radius: 4px;
  background: #fff;
  color: #000;
}
#loginScreen button {
  padding: 8px 16px;
  margin-top: 5px;
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
#loginScreen button:hover { background: #45a049; }

#gameScreen {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
#topBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #444;
  padding: 4px 8px;
}
#playerList {
  font-size: 14px;
}
#editorPanel button {
  padding: 4px 8px;
  margin-right: 4px;
}
#toolPanel button {
  padding: 4px 6px;
  margin: 2px 1px;
  font-size: 12px;
  background: #eee;
  color: #000;
  border: 1px solid #999;
  cursor: pointer;
}
#toolPanel button.active {
  background: #ff0;
  color: #000;
  border-color: #cc0;
}
#controls {
  margin-top: 10px;
}
#statsPanel {
  background: #fff;
  padding: 6px;
  border: 1px solid #ccc;
  max-height: 200px;
  overflow-y: auto;
}
.charRow {
  margin-bottom: 4px;
}
.charRow button {
  margin-left: 4px;
  font-size: 12px;
}
#controls button {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  background: #007acc;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
#controls button:hover { background: #006bb3; }

/* top bar buttons */
#editorControls button {
  padding: 4px 8px;
  background: #888;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
}
#editorControls button:disabled {
  opacity: 0.4;
  cursor: default;
}
#editorControls button:hover:not(:disabled){
  background: #aaa;
}
#toggleGridBtn {
  background: #555;
}
#toggleGridBtn:hover { background: #666; }
#controls input[type=text],
#controls input[type=number],
#controls select {
  width: 100%;
  padding: 4px;
  margin-bottom: 6px;
  box-sizing: border-box;
}

/* additional styling for offset sliders/numbers to fit config panel */
#configPanel input[type=range] {
  width: 120px;
  vertical-align: middle;
}
#configPanel input[type=number] {
  width: 60px;
  display: inline-block;
}
#configPanel {
  background: #fff;
  color: #000;
  padding: 8px;
  border-radius: 4px;
}
#mapCanvas {
  border: 1px solid #555;
  background: #222;
  cursor: crosshair;
  flex: 1;
  width: 100%;
  height: 100%;
}
.editor-highlight {
  stroke: yellow;
  stroke-width: 2;
  fill: none;
}

#topBar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
}

#gameScreen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-top: 40px; /* reserve space for fixed bar */
}

/* generic modal container */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal .modal-content {
  background: #fff;
  color: #000;
  padding: 16px;
  border-radius: 6px;
  width: 260px;
  box-sizing: border-box;
}
/* modal dialog for character editing */
#charModal {
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
#charModal .modal-content {
  background: #fff;
  color: #000;
  padding: 16px;
  border-radius: 6px;
  width: 260px;
  box-sizing: border-box;
}
#charModal label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}
#charModal input {
  width: 100%;
  padding: 4px;
  box-sizing: border-box;
  margin-top: 2px;
}
#charModal button,
#lightModal button {
  margin-right: 6px;
  padding: 6px 10px;
}
#lightModal label {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}
#lightModal input {
  width: 100%;
  padding: 4px;
  box-sizing: border-box;
}

/* improved appearance for all modal dialogs */
.modal .modal-content {
  font-family: Arial, sans-serif;
  width: 320px; /* a little wider */
}
.modal .modal-content label {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
  font-size: 14px;
}
.modal .modal-content input[type="text"],
.modal .modal-content input[type="number"],
.modal .modal-content select {
  width: 100%;
  padding: 6px;
  box-sizing: border-box;
  margin-top: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.modal .modal-content button {
  background: #007acc;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  padding: 6px 10px;
}
.modal .modal-content button:hover {
  background: #005a9e;
}
.modal .modal-content h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

