* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, sans-serif;
  margin: 0 auto;
  max-width: 800px;
  padding: 0 1em;
}

form input {
  width: 100%;
}

button {
  background: black;
  border: 0;
  border-radius: 0.5em;
  color: white;
  font-weight: bold;
  padding: 0.5em 0.75em;
}

#timer {
  text-align: center;
}

#pause {
  color: #666666;
  cursor: pointer;
}

#pause:hover {
  color: inherit;
}

#dialog_resume::backdrop {
  background-color: #ffffff;
}

#byline {
  margin-top: 0;
}

#crossword-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2em;
  justify-content: center;
  margin: 0 calc(50% - 50vw);
  padding: 0 2em;
  width: 100vw;
}

#crossword-board svg {
  max-height: fit-content; /* ??? */
  max-width: 100%;
}

#clues {
  flex: 1 1 250px;
  max-width: fit-content;
}

#clues h3 {
  margin: 0;
}

#clues ul {
  list-style-type: none;
  margin: 0 0 1em 0;
  padding: 0 0 0 2em;
}

#clues li {
  padding: 0.25em 0;
  position: relative;
}

#clues li.complete {
  color: #666666;
  text-decoration: line-through;
}

#clues li.active, #clues li.active:before {
  background-color: #FAE8C7;
}

#clues li:before {
  bottom: 0;
  content: '';
  display: block;
  position: absolute;
  right: 100%;
  top: 0;
  width: 2em;
  z-index: -1;
}

#clues li::marker {
  content: attr(data-label) ". ";
}

#crossword-board svg {
  user-select: none;
}

#crossword-board .cells > g {
  pointer-events: bounding-box;
}

#crossword-board .cells > g.active rect {
  fill: #FAE8C7;
}

#crossword-board .cells > g.focus rect {
  fill: #FDAA45;
}

#mobile-controls {
  background-color: #eeeeee;
  bottom: 0;
  display: none;
  left: 0;
  padding: 0.5em 0.5em 1em;
  position: fixed;
  right: 0;
}

#mobile-clues {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5em;
}

#mobile-clues > div {
  background-color: #333333;
  border-radius: 4px;
  color: white;
  font-size: 1.5em;
  font-weight: bold;
  width: 1.4em;
  text-align: center;
}

#keyboard {
  display: flex;
  flex-flow: column;
  gap: 0.25em;
}

#keyboard > div {
  display: flex;
  gap: 0.25em;
}

#keyboard .key[data-key] {
  background-color: lightgrey;
  border-radius: 4px;
}

#keyboard .key {
  flex: 1 1;
  font-size: 1.5em;
  font-weight: bold;
  line-height: 3em;
  text-align: center;
}

#dialog_finish img {
  max-width: 100%;
}

@media screen and (width <= 500px) {
  h1 {
    font-size: 1.25em;
    margin-bottom: 0.4em;
  }

  #clues h3,
  #clues li:not(.active) {
    display: none;
  }

  #clues li {
    padding-right: 1em;
  }

  #clues ul {
    margin: 0;
  }

  #crossword-container {
    padding: 0 1em;
  }

  #mobile-controls {
    display: block;
  }
}
