:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  background: #101318;
  color: #eef2f1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #101318;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid #86b7a6;
  border-radius: 6px;
  padding: 10px 12px;
  color: #f7fbf9;
  background: #23624f;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  border: 1px solid #3c4650;
  border-radius: 6px;
  padding: 9px 10px;
  color: #f7fbf9;
  background: #171c23;
}

.shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid #2b343d;
  padding: 18px;
  background: #151a20;
}

.brand h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.brand span {
  display: block;
  margin-top: 4px;
  color: #aab7b7;
}

.panel {
  border: 1px solid #2f3942;
  border-radius: 8px;
  padding: 14px;
  background: #1b2128;
}

.panel h2,
.inspect h2 {
  margin: 0 0 12px;
  font-size: 17px;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: #c8d1d0;
  font-size: 14px;
}

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

.character-sheet dl {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px 10px;
  margin: 0;
}

.character-sheet dt {
  color: #96a4a4;
}

.character-sheet dd {
  margin: 0;
}

.message {
  min-height: 22px;
  margin: 0;
  color: #ffd58a;
}

.nearby-panel ol {
  overflow: auto;
  max-height: 210px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nearby-panel li {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 8px;
  border-top: 1px solid #2b343d;
  padding: 6px 0;
  color: #d2dcdb;
}

.nearby-panel li:first-child {
  border-top: 0;
}

.nearby-panel .entity-type {
  color: #f2d27c;
}

.game {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(320px, 1fr) auto minmax(150px, 220px);
  gap: 12px;
  padding: 18px;
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#connection-status {
  color: #aab7b7;
}

#connection-status.connected {
  color: #9cd7b7;
}

#connection-status.disconnected {
  color: #f3ad9a;
}

.dropdown-panel,
.online-panel {
  border: 1px solid #38434c;
  border-radius: 8px;
  padding: 12px;
  background: #1b2128;
}

.dropdown-panel h2,
.online-panel h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

#help-topics {
  display: grid;
  gap: 10px;
}

#help-topics article {
  border-top: 1px solid #2b343d;
  padding-top: 8px;
}

#help-topics article:first-child {
  border-top: 0;
  padding-top: 0;
}

#help-topics h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

#help-topics p {
  margin: 0;
  color: #d2dcdb;
}

.online-panel ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.online-panel li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #2b343d;
  padding-top: 6px;
  color: #d2dcdb;
}

.online-panel li:first-child {
  border-top: 0;
  padding-top: 0;
}

#world {
  width: 100%;
  max-height: calc(100vh - 300px);
  aspect-ratio: 41 / 29;
  border: 1px solid #38434c;
  border-radius: 8px;
  background: #0b0f13;
  image-rendering: pixelated;
}

.inspect {
  min-height: 110px;
}

.inspect p {
  margin: 0;
  color: #d2dcdb;
}

.chat-window {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  min-height: 220px;
  border: 1px solid #38434c;
  border-radius: 8px;
  padding: 12px;
  background: #1b2128;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-header h2,
.chat-header h2 {
  font-size: 17px;
}

.chat-channels {
  display: flex;
  gap: 8px;
}

.chat-channels button {
  background: #202934;
  border-color: #46525d;
}

.chat-channels button.active {
  background: #23624f;
  border-color: #86b7a6;
}

.chat-log {
  overflow: auto;
  min-height: 0;
  margin: 0;
  padding: 8px;
  border: 1px solid #2f3942;
  border-radius: 8px;
  background: #151a20;
  list-style: none;
}

.chat-log li {
  margin-bottom: 8px;
  color: #d2dcdb;
  overflow-wrap: anywhere;
}

.chat-log li:last-child {
  margin-bottom: 0;
}

.chat-log strong {
  color: #f2d27c;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.command-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.console {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  min-height: 120px;
  border: 1px solid #2f3942;
  border-radius: 8px;
  padding: 12px;
  background: #151a20;
}

.console h2 {
  margin: 0;
  font-size: 17px;
}

#console-log {
  overflow: auto;
  min-height: 0;
  max-height: 12lh;
  margin: 0;
  padding: 0;
  color: #d2dcdb;
  list-style: none;
}

#console-log li {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid #2b343d;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .chat-header,
  .chat-form {
    grid-template-columns: 1fr;
  }

  .chat-header {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-channels {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .command-form {
    grid-template-columns: 1fr;
  }

  #world {
    max-height: none;
  }
}
