:root {
  --color-buy: #0a0;
  --color-sell: #a00;
  --color-buy-light: #6c6;
  --color-sell-light: #c66;
}

body {
  background: #000;
  color: #fff;
  font-family: monospace;
  margin: 0;
}

button {
  background: #000;
  border: 1px solid #fff;
  color: #fff;
  cursor: pointer;
  font: inherit;
  padding: 0.25rem 0.75rem;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.bar {
  align-items: center;
  display: flex;
  min-height: 2.5rem;
  padding: 0 0.75rem;
}

.bar-section {
  align-items: center;
  display: flex;
  padding: 0 0.75rem;
}

.bar-section + .bar-section {
  border-left: 1px solid #fff;
}

.topbar {
  border-bottom: 1px solid #fff;
}

.bar-section--status {
  margin-left: auto;
}

.offline-indicator {
  color: #f44;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.bottombar {
  border-top: 1px solid #fff;
}

.main-panel {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.scroll-pane {
  display: flex;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.content-panel {
  border-right: 1px solid #fff;
  box-sizing: border-box;
  display: flex;
  flex: 0 0 488px;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 0.75rem 0;
  width: 488px;
}

.content-panel .market-topbar {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.content-panel h2 {
  font-size: 1rem;
  font-weight: normal;
  margin: 0 0 0.75rem;
}

.market-topbar {
  align-items: center;
  border-bottom: 1px solid #fff;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr auto 1fr;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
}

.market-title-row {
  align-items: center;
  display: flex;
  font-size: 1rem;
  gap: 0.25rem;
  grid-column: 1;
  justify-self: start;
  line-height: 1;
  min-width: 0;
}

.spread-indicator {
  align-items: center;
  display: inline-flex;
  flex-shrink: 0;
  font-size: 0.9em;
  height: 1em;
  justify-content: center;
  line-height: 1;
  width: 1em;
}

.spread-indicator--neutral {
  color: #888;
  transform: translateY(0.02em);
}

.spread-indicator--buy {
  color: var(--color-buy);
  transform: translateY(0.08em);
}

.spread-indicator--sell {
  color: var(--color-sell);
  transform: translateY(-0.08em);
}

.market-topbar .market-name {
  font-size: 1rem;
  font-weight: normal;
  line-height: 1;
  margin: 0;
  min-width: 0;
}

.market-topbar-center-group {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  grid-column: 2;
  justify-self: center;
}

.market-topbar-center {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  line-height: 1;
}

.market-topbar-metrics {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  line-height: 1;
}

.market-metric {
  align-items: baseline;
  display: flex;
  font-size: 0.75rem;
  gap: 0.375rem;
  justify-content: flex-end;
  white-space: nowrap;
}

.market-metric-label {
  color: #888;
}

.market-metric-value--positive {
  color: var(--color-buy);
}

.market-metric-value--negative {
  color: var(--color-sell);
}

.market-best-prices {
  flex-shrink: 0;
  font-size: 0.875rem;
  line-height: 1;
}

.market-best-prices-bid {
  color: var(--color-buy);
}

.market-best-prices-ask {
  color: var(--color-sell);
}

.market-best-prices-separator {
  color: #888;
}

.market-position-indicator {
  font-size: 0.75rem;
  line-height: 1;
  min-height: 1em;
  text-align: center;
}

.market-position-indicator--long {
  color: var(--color-buy);
}

.market-position-indicator--short {
  color: var(--color-sell);
}

.market-close-button {
  flex-shrink: 0;
  grid-column: 3;
  justify-self: end;
  line-height: 1;
  padding: 0.125rem 0.5rem;
}

.market-book-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  width: 100%;
}

.market-bottom-pane {
  border-top: 1px solid #fff;
  box-sizing: border-box;
  flex-shrink: 0;
  padding: 0.5625rem 0.75rem 0.375rem;
  width: 100%;
}

.trade-feed {
  border: 1px solid #333;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
  max-height: 5.5rem;
  min-height: 2.5rem;
  overflow: hidden;
  padding: 0.25rem 0.375rem;
}

.trade-feed-inner {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.trade-feed-entry {
  animation: trade-feed-fade 10s linear forwards;
  font-size: 0.6875rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-feed-entry--static {
  animation: none;
  opacity: 0.55;
}

.trade-feed-user--buyer {
  color: var(--color-buy-light);
}

.trade-feed-user--seller {
  color: var(--color-sell-light);
}

.trade-feed-price {
  color: #ccc;
}

@keyframes trade-feed-fade {
  0%, 55% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.cancel-all-orders-button {
  background: #004a99;
  border: 1px solid #004a99;
  box-sizing: border-box;
  color: #fff;
  cursor: pointer;
  display: block;
  font: inherit;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  padding: 0.375rem 0.75rem;
  width: 100%;
}

.cancel-all-orders-button:hover {
  background: #005bb8;
  border-color: #005bb8;
}

.cancel-all-orders-button:disabled {
  background: #333;
  border-color: #555;
  color: #888;
  cursor: not-allowed;
}

.market-book-container {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  width: 100%;
}

.market-book-container::-webkit-scrollbar {
  display: none;
}

.add-market-pane {
  align-items: center;
  justify-content: center;
  padding: 0;
  position: relative;
}

.add-market-button {
  align-items: center;
  background: transparent;
  border: none;
  color: #fff;
  display: flex;
  flex: 1;
  font-size: 3rem;
  height: 100%;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 100%;
}

.add-market-pane .market-picker-menu {
  left: 50%;
  min-width: 12rem;
  top: 50%;
  transform: translate(-50%, -50%);
}

.market-picker-menu {
  background: #000;
  border: 1px solid #fff;
  min-width: 12rem;
  padding: 0.5rem;
  position: absolute;
  z-index: 1;
}

.market-picker-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.market-picker-item {
  background: #333;
  border: 1px solid #555;
  color: #fff;
  cursor: pointer;
  font: inherit;
  padding: 0.375rem 0.5rem;
  text-align: left;
  width: 100%;
}

.market-picker-empty {
  color: #888;
  font-size: 0.75rem;
}

.order-book {
  display: flex;
  flex: 1;
  flex-direction: column;
  font-size: 0.8125rem;
  justify-content: flex-start;
  max-width: 100%;
  min-width: 0;
}

.order-book-rows {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
}

.order-book-row {
  align-items: center;
  box-sizing: border-box;
  flex-shrink: 0;
  max-width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 5.5rem) minmax(0, 1fr) auto minmax(0, 1fr) minmax(0, 5.5rem);
  height: 1.375rem;
}

.order-book-cell--action {
  align-items: center;
  box-sizing: border-box;
  display: flex;
  flex-shrink: 0;
  gap: 0.1rem;
  max-width: 5.5rem;
  min-width: 5.5rem;
  width: 5.5rem;
}

.order-book-action-slot {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  height: 100%;
  justify-content: center;
}

.order-book-action-slot--cancel {
  width: 1.125rem;
}

.order-book-action-slot--button {
  width: 2.5rem;
}

.order-book-action-slot--depth {
  width: 1.375rem;
}

.order-book-cell--action-left {
  justify-content: flex-start;
  padding-left: 0.1rem;
}

.order-book-cell--action-right {
  justify-content: flex-end;
  padding-right: 0.1rem;
}

.order-book-cell--bid,
.order-book-cell--ask,
.order-book-cell--price {
  box-sizing: border-box;
  min-width: 0;
}

.order-book-cell--bid {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: flex-end;
  padding: 0 0.25rem 0 0;
}

.order-book-cell--price {
  align-items: center;
  border-left: 1px solid #fff;
  border-right: 1px solid #fff;
  display: flex;
  height: 100%;
  justify-content: center;
  min-width: 2.75rem;
  padding: 0 0.25rem;
}

.order-book-row--spread {
  background: #101010;
}

.order-book-row--floor {
  border-bottom: 1px solid #fff;
}

.order-book-row--inactive .order-book-price {
  color: #555;
}

.order-book-price {
  text-align: center;
}

.order-book-price--bid {
  color: var(--color-buy-light);
}

.order-book-price--ask {
  color: var(--color-sell-light);
}

.book-depth-qty {
  color: #bbb;
  font-size: 0.5625rem;
  line-height: 1;
  min-width: 1.25rem;
}

.order-book-cell--action-left .order-book-action-slot--depth {
  justify-content: flex-start;
}

.order-book-cell--action-left .book-depth-qty {
  text-align: left;
}

.order-book-cell--action-right .order-book-action-slot--depth {
  justify-content: flex-end;
}

.order-book-cell--action-right .book-depth-qty {
  text-align: right;
}

.book-cancel-button {
  background: #111;
  border: 1px solid #555;
  box-sizing: border-box;
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 0.5625rem;
  height: 1.125rem;
  line-height: 1;
  padding: 0;
  width: 1.125rem;
}

.book-cancel-button:hover {
  border-color: #fff;
}

.book-cancel-button--invisible {
  pointer-events: none;
  visibility: hidden;
}

.book-quick-button {
  background: #111;
  border: 1px solid #555;
  box-sizing: border-box;
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 0.5625rem;
  height: 1.125rem;
  line-height: 1;
  max-width: 2.5rem;
  min-width: 2.5rem;
  padding: 0 0.1rem;
  text-align: center;
  width: 2.5rem;
}

.order-button-group {
  display: flex;
  max-width: 100%;
  min-width: 0;
}

body.max-modifier-active [data-hide-on-max] {
  display: none !important;
}

.order-book-cell--action .order-button-group {
  width: auto;
}

.book-quick-button--bid:hover {
  border-color: var(--color-buy);
}

.book-quick-button--ask:hover {
  border-color: var(--color-sell);
}

.book-quick-button--buy {
  background: var(--color-buy);
  border-color: var(--color-buy);
}

.book-quick-button--sell {
  background: var(--color-sell);
  border-color: var(--color-sell);
}

.book-quick-button--buy:hover {
  border-color: var(--color-buy);
}

.book-quick-button--sell:hover {
  border-color: var(--color-sell);
}

.order-book-cell--ask {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: flex-start;
  padding: 0 0 0 0.25rem;
}

.order-book-cell--bid,
.order-book-cell--ask {
  position: relative;
}

.order-entry {
  align-items: center;
  box-sizing: border-box;
  display: flex;
  gap: 0.25rem;
  height: 100%;
  padding: 0 0.25rem;
  position: relative;
  width: 100%;
}

.order-entry--bid {
  justify-content: flex-end;
  text-align: right;
}

.order-entry--ask {
  justify-content: flex-start;
}

.order-bar {
  bottom: 0;
  opacity: 0.45;
  position: absolute;
  top: 0;
  z-index: 0;
}

.order-entry--bid .order-bar {
  background: var(--color-buy);
  right: 0;
}

.order-entry--ask .order-bar {
  background: var(--color-sell);
  left: 0;
}

.login {
  margin: 4rem auto;
  max-width: 20rem;
  padding: 0 1rem;
}

.login form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.login input,
.login button {
  padding: 0.5rem;
}

.form-message {
  color: #ccc;
  font-size: 0.75rem;
  margin: 0;
}

.login-error,
.form-message--error {
  color: #f87171;
  margin: 0;
}

.admin-link {
  color: #fff;
  text-decoration: none;
}

.admin-title {
  font-size: 1rem;
  font-weight: normal;
  margin: 0;
}

.admin-panel {
  display: grid;
  flex: 1;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
}

.admin-status {
  border: 1px solid #555;
  box-sizing: border-box;
  grid-column: 1 / -1;
  padding: 0.75rem;
}

.admin-section {
  border: 1px solid #fff;
  padding: 1rem;
}

.admin-section-title {
  border-bottom: 1px solid #fff;
  font-size: 1rem;
  font-weight: normal;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-label {
  font-size: 0.75rem;
}

.admin-input {
  background: #333;
  border: 1px solid #555;
  box-sizing: border-box;
  color: #fff;
  font: inherit;
  padding: 0.375rem 0.5rem;
}

.admin-hint {
  color: #888;
  font-size: 0.75rem;
  margin: 0.75rem 0 0;
}
