/* App layout on top of 98.css. Only pieces 98.css does not have; 98 palette only. */

:root {
  --face: #c0c0c0;
  --shadow: #808080;
  --dark: #000000;
  --light: #ffffff;
  --title: #000080;
  --red: #aa0000;
  --blue: #0000aa;
  --grey-text: #808080;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: #008080;
}

#app {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 24px 12px 52px; /* room for the taskbar */
  box-sizing: border-box;
}

.window-body p {
  margin: 0 0 8px;
}

.field-row + .field-row,
.field-row + fieldset,
fieldset + .field-row,
fieldset + fieldset {
  margin-top: 8px;
}

/* ------------------------------------------------ lobby browser */

.window.browser {
  width: 460px;
}

.browser #player-name {
  width: 160px;
}

.rooms-panel {
  height: 180px;
  margin-top: 8px;
}

.rooms-table {
  width: 100%;
}

.rooms-table td.empty {
  color: var(--grey-text);
  text-align: center;
}

.browser-actions {
  margin-top: 8px;
}

.code-input {
  width: 48px;
  text-transform: uppercase;
}

/* ------------------------------------------------ room lobby */

.window.lobby {
  width: 520px;
}

.teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.player-list,
.roster {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 96px;
}

.roster {
  min-height: 0;
}

.player-list li,
.roster li {
  padding: 1px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ready-mark {
  display: inline-block;
  width: 14px;
  font-weight: bold;
}

.team-0 > legend {
  color: var(--red);
}

.team-1 > legend {
  color: var(--blue);
}

li.me {
  font-weight: bold;
}

li.disconnected,
li.empty {
  color: var(--grey-text);
}

.tags {
  color: #404040;
}

.settings .field-row label {
  display: inline-block;
  width: 96px;
}

.invite {
  flex: 1;
}

.invite-row {
  margin-top: 8px;
}

.lobby-actions {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bot-row[hidden] {
  display: none;
}

.lobby-actions .start-button {
  margin-left: auto;
}

button.remove-bot {
  min-width: 0;
  min-height: 0;
  padding: 0 6px;
  margin-left: 6px;
  font-size: 11px;
}

.start-button {
  min-width: 96px;
  font-weight: bold;
}

/* ------------------------------------------------ game */

.window.game {
  max-width: calc(100vw - 24px);
}

.game-main {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.field-box {
  border: 2px solid;
  border-color: var(--shadow) var(--light) var(--light) var(--shadow);
  line-height: 0;
  background: var(--light);
}

canvas.field {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

.side-panel {
  width: 210px;
  flex: none;
}

.side-panel fieldset {
  margin: 0 0 6px;
}

.marks {
  float: right;
}

.soldier {
  margin-left: 2px;
}

.soldier.alive.team-0 {
  color: var(--red);
}

.soldier.alive.team-1 {
  color: var(--blue);
}

.soldier.dead {
  color: var(--grey-text);
}

.timer .progress-indicator {
  height: 16px;
}

.timer-text {
  display: block;
  margin-top: 2px;
  text-align: right;
}

.log-panel {
  height: 140px;
  overflow-y: auto;
  background: var(--light);
}

.shot-log {
  list-style: none;
  margin: 0;
  padding: 2px 4px;
  font-family: "Courier New", monospace;
  font-size: 11px;
}

.shot-log li {
  overflow-wrap: anywhere;
}

.fire-row {
  margin-top: 8px;
}

.y-label {
  font-family: "Courier New", monospace;
  font-weight: bold;
}

.expr-input {
  flex: 1;
  font-family: "Courier New", monospace;
}

.fire-button {
  min-width: 72px;
  font-weight: bold;
}

/* ------------------------------------------------ dialogs */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  z-index: 10;
}

.window.dialog {
  min-width: 260px;
  max-width: 460px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.35);
}

.dialog-content {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 4px;
}

.dialog-icon {
  flex: none;
}

.dialog-text p {
  margin: 6px 0;
}

.caret-box {
  margin: 4px 0 0;
  padding: 4px 6px;
  background: var(--light);
  border: 2px solid;
  border-color: var(--shadow) var(--light) var(--light) var(--shadow);
  font-family: "Courier New", monospace;
  font-size: 12px;
  white-space: pre;
  overflow-x: auto;
}

.dialog-buttons {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 4px 0 2px;
}

.dialog-buttons button {
  min-width: 75px;
}

.game-over-text {
  font-size: 14px;
  font-weight: bold;
}

/* ------------------------------------------------ help */

.help-list {
  margin: 4px 0 8px;
  padding-left: 18px;
}

.help-list li {
  margin: 3px 0;
}

.help-list code,
.help-examples {
  font-family: "Courier New", monospace;
}

.help-examples {
  margin: 0 0 8px;
  padding: 4px 6px;
  background: var(--light);
  border: 2px solid;
  border-color: var(--shadow) var(--light) var(--light) var(--shadow);
}

.help-link {
  margin-left: 4px;
}

.window.dialog:has(.help-list) {
  max-width: 520px;
}

/* ------------------------------------------------ taskbar (decorative) */

.taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  box-sizing: border-box;
  background: var(--face);
  border-top: 1px solid var(--light);
  box-shadow: inset 0 1px 0 #dfdfdf;
  z-index: 5;
}

.start-btn {
  min-width: 0;
  height: 22px;
  padding: 0 6px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 4px;
}

.start-logo {
  flex: none;
}

.taskbar-task {
  height: 22px;
  line-height: 22px;
  padding: 0 8px;
  min-width: 140px;
  box-sizing: border-box;
  font-weight: bold;
  background: #dfdfdf;
  box-shadow:
    inset -1px -1px var(--light),
    inset 1px 1px var(--dark),
    inset -2px -2px #dfdfdf,
    inset 2px 2px var(--shadow);
}

.taskbar-tray {
  margin-left: auto;
  height: 22px;
  line-height: 22px;
  padding: 0 10px;
  box-shadow:
    inset -1px -1px var(--light),
    inset 1px 1px var(--shadow);
}
