:root {
  --max-canvas-height: 100%;
}

main {
  background: transparent;
  display: flex;
  flex-direction: column;
}

.orientation-message {
  display: none;
  position: absolute;
  background: var(--shade);
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
}

#container {
  display: flex;
  flex-direction: column;
}

#canvas-container {
  overflow: hidden;
  border-radius: 0 0 0.5rem 0.5rem;
  max-width: 100%;
  /* aspect-ratio: 4/3; */
  display: flex;
  justify-content: center;
}

#canvas {
  max-height: var(--max-canvas-height);
  aspect-ratio: 4/3;
  max-width: 100%;
  background-color: var(--secondary);
  border-radius: 0 0 0.5rem 0.5rem;
  cursor: cell;
}

#controlls {
  background-color: var(--accent);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.colors {
  overflow: hidden;
}

.colors-row {
  display: flex;
  flex-direction: row;
}

.clr {
  height: 1em;
  aspect-ratio: 1;
}

#buttons {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-around;
  padding: 0.1em 0;
}

#sizes {
  flex-direction: row;
}

.size {
  height: 100%;
  aspect-ratio: 1;
  border-radius: 0.5em;
  display: grid;
  justify-content: center;
  align-content: center;
}

.size-ball {
  background-color: black;
  border-radius: 50%;
  aspect-ratio: 1;
}

#buttons > div {
  height: 1.8em;
  display: flex;
}

#controlls,
#buttons,
#buttons > div {
  gap: 0.2em;
}

#chat {
  display: flex;
  flex-direction: column;
  background-color: var(--accent);
  margin: 0.5em;
  padding: 0.2em;
  border: 0.2em solid var(--secondary);
  border-radius: 0.5em;
}

#chat > h2 {
  text-shadow: 2px 2px 2px var(--background);
}

#chat-area {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#chat-text {
  display: flex;
  flex-direction: column;
  overflow: auto;
}

#chat-text > span {
  font-weight: bold;
}

#chat-input {
  height: 100%;
  border: 0;
  background-color: transparent;
  color: var(--secondary);
}

#chat-input:focus {
  outline: 0;
}

.chat-inputs > button {
  margin: 0.2rem;
  padding: 0 0.2rem;
}

#chat-inputs {
  border: 0.2em dashed var(--secondary);
  border-radius: 0.4em;
  height: 1.8rem;
  padding: 0.2em;
  display: flex;
  flex-direction: row;
}

#chat-inputs > button {
  padding: 0 0.4em;
}

#controlls .button {
  padding: 0 0.5em;
}

/* MEDIA QUERIES */

/* mobile landscape */
@media screen and (orientation: landscape) and (max-width: 56.25em) {
  /* mobile-landscape-max */
  .orientation-message {
    display: flex;
  }
}

/* tablet */
@media screen and (min-width: 56.25em) {
  /* tablet-portrait-min */
  main {
    flex-direction: row;
  }
}

@media screen and (min-width: 56.25em) and (max-width: 75em) {
  /* tablet-landscape */
  h2 {
    margin: 0.2em;
  }

  main {
    margin: 0.4em 0;
    border-radius: 0;
  }

  #container {
    justify-content: center;
  }

  #controlls {
    border-radius: 0;
  }

  #canvas {
    border-radius: 0 0 0.5rem 0;
  }

  #chat {
    margin-right: 0;
    border-radius: 0.5em 0 0 0.5em;
    border-right: 0;
  }

  /* HACK: I can't figure out how to automatically expand controlls width when its children wrap */
  @media screen and (max-height: 42.8em) {
    #controlls {
      width: 4.2em;
    }
  }
}

/* landscape smaller than computer */
@media screen and (orientation: landscape) and (max-width: 75em) {
  /* tablet-landscape-max */
  .button > .big {
    display: none;
  }

  .button > .small {
    display: block;
  }
  a.button > .small {
    display: inline;
  }

  #container,
  #colors {
    flex-direction: row;
  }

  #controlls,
  .colors-row,
  #buttons,
  #buttons > div {
    flex-direction: column;
  }

  #controlls {
    display: flex;
  }

  #colors {
    display: flex;
  }

  .colors-row {
    width: 1em;
  }

  #buttons {
    padding: 0 0.1em;
  }

  .size {
    width: 100%;
  }

  #buttons > div {
    height: inherit;
    width: 1.8em;
  }

  #canvas-container {
    max-width: unset;
    height: 100%;
    aspect-ratio: 4/3;
    border-radius: 0 0.5em 0.5em 0;
  }

  #canvas {
    max-height: 100%;
    aspect-ratio: 4/3;
    border-radius: 0 0.5em 0.5em 0;
  }
}

/* PC */
@media screen and (min-width: 75em) {
  /* desktop-min */
  #controlls {
    border-radius: 0.5em 0.5em 0 0;
  }
}

/* experimental area!!! */
#canvas-container {
  position: relative;
}

#lobby {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--shade);
}

#lobby > * {
  margin: 0.2em;
}

#lobby-2 {
  border-bottom: 0.2em dashed var(--secondary);
  display: none;
}
