:root {
  color-scheme: dark;
  --bg: #14161c;
  --panel: #1f232c;
  --wall: #4a4e5a;
  --floor: #23262f;
  --goal: #3a3f4d;
  --box: #b5824a;
  --box-on-goal: #6fae5c;
  --player: #5aa7e0;
  --text: #e8e9ee;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
}

.layout {
  display: flex;
  gap: 24px;
  padding: 24px;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
}

.board-wrapper {
  position: relative;
}

#board-canvas {
  background: var(--floor);
  border-radius: 8px;
  display: block;
}

.panel {
  background: var(--panel);
  border-radius: 8px;
  padding: 16px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hud div {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

button {
  background: var(--goal);
  color: var(--text);
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
}

button:hover {
  background: var(--wall);
}

button:disabled {
  background: var(--floor);
  color: rgba(232, 233, 238, 0.4);
  cursor: not-allowed;
}

button:disabled:hover {
  background: var(--floor);
}

.overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8%;
  display: flex;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}

.overlay button {
  pointer-events: auto;
}

.overlay[hidden] {
  display: none;
}

dialog {
  background: var(--panel);
  color: var(--text);
  border: none;
  border-radius: 8px;
  padding: 20px;
  min-width: 240px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

#level-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

#level-list li button {
  width: 100%;
  text-align: left;
}

.sync-panel {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#sync-active {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}
