:root {
  color-scheme: dark;
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  background: #191725;
  color: #f9f6ef;
}

* { box-sizing: border-box; }

body { margin: 0; }

main {
  width: min(100% - 2rem, 40rem);
  margin: clamp(1rem, 4vh, 2.5rem) auto;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem 1rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3.5rem);
  line-height: 1;
  letter-spacing: -.08em;
}

#connection {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  color: #f6d74e;
  font-size: .875rem;
}

#connection::before {
  content: '';
  width: .48rem;
  aspect-ratio: 1;
  background: currentColor;
}

#connection[data-state='live'] { color: #61cea7; }

#instructions {
  margin: .75rem 0 1rem;
  color: #d5cfe0;
  font-size: .875rem;
  line-height: 1.5;
}

#palette {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: clamp(.25rem, 1.4vw, .5rem);
  margin-bottom: .625rem;
}

button {
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

#palette button {
  min-height: 2.25rem;
  border: 2px solid #777087;
  border-radius: .25rem;
  background: var(--color);
}

#palette button[aria-pressed='true'] {
  border-color: #fff;
  box-shadow: inset 0 0 0 2px #191725;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .375rem;
  margin-bottom: .625rem;
}

.toolbar button,
#jump button,
#jump input {
  border: 1px solid #777087;
  border-radius: .25rem;
  background: #29263a;
  color: inherit;
  font: inherit;
  font-size: .875rem;
  min-height: 2.25rem;
  padding: .25rem .625rem;
}

.toolbar button { min-width: 2.25rem; }
button:disabled { opacity: .42; cursor: default; }

#zoom-status {
  margin-left: auto;
  color: #d5cfe0;
  font-size: .875rem;
}

.board-frame {
  border: 1px solid #777087;
  background: #302d40;
}

#board {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  user-select: none;
  touch-action: none;
  cursor: zoom-in;
}

#board[data-can-place='true'][data-live='true'] { cursor: crosshair; }
#board[data-can-place='true'][data-live='false'] { cursor: grab; }
#board:active { cursor: grabbing; }

:focus-visible {
  outline: 2px solid #f9f6ef;
  outline-offset: 2px;
}

#board:focus-visible {
  outline-offset: -2px;
  outline-color: #537bff;
}

.board-footer {
  margin-top: .75rem;
  font-size: .875rem;
}

#jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

#jump label { display: flex; align-items: center; gap: .25rem; }
#jump input { width: 4.5rem; font-size: 1rem; }
#notice { margin: .6rem 0 0; color: #d5cfe0; }
#notice[data-error='true'] { color: #ff9da6; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
