* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  height: 100dvh;
  background-color: #000;
  overscroll-behavior: none;
  display: grid;
  place-items: center;
}

#container {
  container-type: inline-size;
  --aspect-ratio: 1200 / 732;
  position: relative;
  width: min(100vw, calc(100dvh * var(--aspect-ratio)));
  background: #000;
  aspect-ratio: var(--aspect-ratio);

  canvas {
    width: 100%;
    height: 100%;
    touch-action: none;
    object-fit: cover;
  }

  .title {
    position: absolute;
    right: 2cqw;
    bottom: 2cqw;
    font-size: 5cqw;
    color: #fff;
    text-shadow: 1cqw 1cqw 1cqw #00000030;
    font-family: sans-serif;
    animation: fadeIn 10s;
    animation-iteration-count: 1;
    animation-fill-mode: both;
  }

  .dialog {
    position: absolute;
    left: 2cqw;
    right: 2cqw;
    bottom: 2cqw;
    font-size: 2.6cqw;
    color: #fff;
    font-family: sans-serif;
    flex-direction: column;
    display: flex;
    transition-duration: .1s;

    &[hidden] {
      opacity: 0;
      pointer-events: none;
    }

    p {
      margin: 0;
      padding: 1cqw;
      background: #000;
      width: fit-content;
      max-width: 40ch;
      border-radius: .75cqw;
      box-shadow: 1cqw 1cqw 1cqw #00000030;

      &.U {
        background-color: #C34FE1;
      }

      &.K {
        background-color: #5490FF;
      }

      &.D {
        background-color: #9F3D23;
      }

      + p {
        margin-block-start: .25lh;
      }
    }

    .choices {
      display: flex;
      justify-content: flex-end;
      gap: 1ch;

      padding: .5cqw 2cqw;
      margin-block-start: .25lh;

      background: #000;
      box-shadow: 1cqw 1cqw 1cqw #00000030;
      width: fit-content;
      align-self: flex-end;
      border-radius: .75cqw;
    }

    button {
      cursor: pointer;
      font: inherit;
      background: none;
      color: inherit;
      border: 0;

      &:before {
        content: " ";
        display: inline-block;
        width: 1.5ch;
        height: .6lh;
        vertical-align: baseline;
      }

      &:focus {
        outline: 0;

        &:before {
          background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' d='M4 12h12.25L11 6.75l.66-.75 6.5 6.5-6.5 6.5-.66-.75L16.25 13H4z'/%3E%3C/svg%3E");
          background-repeat: no-repeat;
          background-size: container;
          background-position: left center;
        }
      }
    }
  }
}

@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(1cqw); }
  20% { opacity: 0; transform: translateY(1cqw); }
  30% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}
