* {
  box-sizing: border-box;
}

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

body {
  background: #0b0b0b;
  color: #d8d8d8;
  font-family: Consolas, "Courier New", monospace;
  overflow: hidden;
}

.login {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: block;
  padding: 64px 16px;
  background: #0b0b0b;
  overflow-y: auto;
  scrollbar-width: none;
}

.login.session-stage {
  padding-top: 32px;
}

.login::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.login.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.login-panel {
  width: 520px;
  max-width: calc(100vw - 32px);
  margin: 0 auto;
  color: #d8d8d8;
  font: 16px/1.25 Consolas, "Courier New", monospace;
}

.login-panel pre {
  margin: 0 0 32px;
  white-space: pre;
  text-align: center;
  transform: translateY(88px);
}

.login.session-stage .login-panel pre {
  transform: none;
}

.session-tabs {
  display: flex;
  gap: 12px;
  margin: 0 0 24px;
}

#auth-screen {
  min-height: calc(100vh - 220px);
  display: flex;
  align-items: center;
}

.auth-centered {
  width: 100%;
  margin-top: -48px;
}

.login-panel label,
.login-panel input,
.login-panel select,
.login-panel button,
.login-panel p {
  display: block;
  width: 100%;
  font: inherit;
}

.login-panel input,
.login-panel select {
  margin: 10px 0 16px;
  padding: 8px 10px;
  border: 1px solid #777;
  outline: 0;
  background: #050505;
  color: #d8d8d8;
}

.login-panel button {
  width: auto;
  padding: 7px 16px;
  border: 1px solid #777;
  background: #111;
  color: #d8d8d8;
  cursor: pointer;
}

.login-panel .session-mode,
.login-panel .auth-mode {
  flex: 1;
  min-width: 0;
  font-size: 14px;
}

.login-panel .session-mode.active,
.login-panel .auth-mode.active {
  border-color: #d8d8d8;
  background: #d8d8d8;
  color: #0b0b0b;
}

.login-panel p,
#session {
  color: #9f9f9f;
}

.user-manager {
  margin: 24px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid #444;
}

#session-list-panel {
  margin: 0 0 18px;
}

#session-list {
  margin: 0;
  min-height: 74px;
  white-space: pre-wrap;
}

.session-item {
  display: block;
  flex: 1;
  margin: 0 0 6px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: #d8d8d8;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.session-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.session-delete {
  width: auto;
  margin: 0 0 6px;
  padding: 4px 8px;
  border: 1px solid #777;
  background: #111;
  color: #d8d8d8;
  font: inherit;
  cursor: pointer;
}

.session-delete:hover {
  border-color: #d8d8d8;
}

.session-item.active,
.session-item:hover {
  background: #d8d8d8;
  color: #0b0b0b;
}

.user-manager pre {
  margin: 0 0 18px;
  min-height: 74px;
  white-space: pre;
}

.user-manager #invitation-result {
  min-height: 24px;
}

.user-manager button {
  margin: 0 0 16px;
}

.super-admin-tools {
  margin: 18px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid #333;
}

.delete-user-block {
  margin-top: 56px;
}

.terminal {
  width: 100vw;
  height: 100vh;
  padding: 18px 0 24px 0;
  background: #0b0b0b;
  color: #d8d8d8;
  overflow: auto;
  scrollbar-width: none;
}

.terminal::-webkit-scrollbar {
  width: 0;
  height: 0;
}

#session {
  position: fixed;
  top: 8px;
  right: 14px;
  z-index: 2;
  display: flex;
  gap: 10px;
  align-items: center;
  font: 13px/1.2 Consolas, "Courier New", monospace;
  text-transform: uppercase;
}

#session button {
  padding: 2px 7px;
  border: 1px solid #777;
  background: #111;
  color: #d8d8d8;
  font: inherit;
  cursor: pointer;
}

#session button:hover {
  border-color: #d8d8d8;
}

#screen-wrap {
  position: relative;
  width: max-content;
  min-width: 100%;
}

.command-buttons {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  font: 16px/1.22 Consolas, "Courier New", monospace;
}

.command-buttons button {
  position: absolute;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid #777;
  background: #111;
  color: #d8d8d8;
  font: 13px/1.2 Consolas, "Courier New", monospace;
  cursor: pointer;
  text-transform: uppercase;
  pointer-events: auto;
}

.command-buttons button:hover {
  border-color: #d8d8d8;
  background: #d8d8d8;
  color: #0b0b0b;
}

.cmd-help {
  top: 0;
  left: 1ch;
}

.cmd-switch {
  top: calc(13 * 1.22em);
  left: 19ch;
}

.cmd-start {
  top: calc((12 + var(--setup-table-lines, 14)) * 1.22em);
  left: 95ch;
}

.cmd-draft {
  top: calc(19 * 1.22em);
}

.cmd-reroll {
  left: 27ch;
}

.cmd-rematch {
  left: 40ch;
}

.cmd-new-game {
  left: 55ch;
}

.cmd-exit {
  left: 71ch;
}

.player-controls {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  font: 16px/1.22 Consolas, "Courier New", monospace;
}

.player-control {
  position: absolute;
  top: calc(var(--line) * 1.22em + 2px);
  display: flex;
  gap: 4px;
  pointer-events: auto;
}

.player-control.challenger {
  left: 72ch;
}

.player-control.spectator {
  left: 104ch;
}

.player-control button {
  min-height: 17px;
  padding: 1px 5px;
  border: 1px solid #777;
  background: #111;
  color: #d8d8d8;
  font: 11px/1 Consolas, "Courier New", monospace;
  cursor: pointer;
  text-transform: uppercase;
}

.player-control button:hover {
  border-color: #d8d8d8;
  background: #d8d8d8;
  color: #0b0b0b;
}

#screen {
  margin: 0;
  white-space: pre;
  font: 16px/1.22 Consolas, "Courier New", monospace;
}

.setup-ui {
  min-width: 100vw;
  min-height: calc(100vh - 58px);
  padding: 14px 18px 28px;
  font: 16px/1.22 Consolas, "Courier New", monospace;
}

.setup-shell {
  position: relative;
  width: min(1180px, calc(100vw - 36px));
  min-height: 540px;
}

.setup-title {
  margin: 0 0 72px;
  text-align: center;
  white-space: pre;
  font: inherit;
}

.setup-help {
  position: absolute;
  top: 0;
  left: 0;
}

.setup-body {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(620px, 1fr);
  gap: 22px;
  align-items: start;
}

.setup-panel,
.setup-table {
  border: 1px solid #777;
  background: #0b0b0b;
}

.setup-panel {
  min-height: 360px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 12px;
  padding: 12px;
}

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

.setup-modes span,
.setup-instructions p,
.setup-status,
.setup-empty {
  display: block;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #444;
  background: #080808;
  color: #d8d8d8;
  font: 13px/1.2 Consolas, "Courier New", monospace;
}

.setup-modes span.active {
  border-color: #d8d8d8;
  background: #d8d8d8;
  color: #0b0b0b;
}

.setup-switch-row {
  display: flex;
  align-items: center;
  justify-content: stretch;
}

.setup-switch-row button {
  width: 100%;
}

.setup-instructions {
  align-self: stretch;
  display: grid;
  align-content: end;
  gap: 8px;
}

.setup-instructions p,
.setup-status,
.setup-empty {
  margin: 0;
}

.setup-status {
  min-height: 34px;
  border-color: #777;
}

.setup-table {
  min-height: 360px;
}

.setup-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 300px;
}

.setup-player-column {
  min-width: 0;
}

.setup-player-column + .setup-player-column {
  border-left: 1px solid #777;
}

.setup-player-column h2 {
  margin: 0;
  min-height: 34px;
  padding: 8px 10px;
  border-bottom: 1px solid #777;
  background: #111;
  font: 13px/1.2 Consolas, "Courier New", monospace;
  text-align: left;
  letter-spacing: 0;
}

.setup-player-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.setup-player-row {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 6px;
  border: 1px solid #444;
  background: #080808;
}

.setup-player-meta {
  white-space: pre;
  color: #9f9f9f;
  font-size: 13px;
}

.setup-player-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.setup-player-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.setup-table-area {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.setup-start {
  display: flex;
  justify-content: center;
  min-width: 78px;
}

.setup-ui button {
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid #777;
  background: #111;
  color: #d8d8d8;
  font: 13px/1.2 Consolas, "Courier New", monospace;
  cursor: pointer;
  text-transform: uppercase;
}

.setup-ui button:hover {
  border-color: #d8d8d8;
  background: #d8d8d8;
  color: #0b0b0b;
}

.setup-player-actions button {
  flex: 0 0 28px;
  width: 28px;
  min-height: 24px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  text-align: center;
}

@media (max-width: 960px) {
  .setup-body {
    grid-template-columns: 1fr;
  }

  .setup-table {
    min-height: 0;
  }
}

#command-form {
  display: flex;
  align-items: baseline;
  margin: 0;
  padding: 0;
  font: 16px/1.22 Consolas, "Courier New", monospace;
}

#prompt {
  white-space: pre;
}

#command {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #d8d8d8;
  caret-color: #d8d8d8;
  font: inherit;
}

#command:disabled {
  display: none;
}

@media (max-width: 720px) {
  #session {
    position: static;
    margin: 0 14px 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .cmd-start {
    left: 95ch;
  }
}
