:root {
  font-family: sans-serif;
  color-scheme: light dark;
}

body {
  margin: 0 0 2rem;
}

#root {
  width: 500px;
  max-width: calc(100% - 20px);
  margin: auto;
}

main {
  border: 1px solid currentColor;
  border-radius: .5rem;
  overflow: hidden;
}

.avatar {
  height: 2em;
  width: 2em;
  position: relative;
  overflow: hidden;
  border-radius: .2rem;
  user-select: none;

  div {
    font-size: 1.5em;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 0 .4em #00000070;
  }

  &::before {
    content: attr(data-emoji);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    scale: 5;
    z-index: -1;
    filter: blur(3px);
  }
}

main output {
  display: flex;
  flex-direction: column;
  padding: .5rem;
  height: min(500px, 60dvh);
  overflow-y: auto;
  gap: .5rem;

  .message {
    display: flex;
    align-items: end;
    gap: .5rem;

    span {
      display: block;
      padding: .5rem .7rem;
      border: 1px solid currentColor;
      border-radius: .5rem;
      border-bottom-left-radius: 0;
      max-width: 70%;
    }

    &.you {
      flex-direction: row-reverse;

      span {
        background: CanvasText;
        color: Canvas;
        border-bottom-left-radius: .5rem;
        border-bottom-right-radius: 0;
      }
    }
  }
}

main form {
  border-top: 1px solid currentColor;
  display: flex;

  .avatar {
    font-size: 1.5rem;
    border-radius: 0;
  }

  input {
    appearance: none;
    border: 0;
    margin: 0;
    padding: 0 1rem;
    font: inherit;
    line-height: 3rem;
    outline: none;
    flex: 1;
    width: auto;
  }

  button {
    appearance: none;
    border: 0;
    background: CanvasText;
    color: Canvas;
    font: inherit;
    padding: 0 .5rem;
    margin: 0;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
  }
}

h2 {
  font-size: 1.2rem;
  margin-top: 2rem;
}

#online {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
