.loading-indicator {
  --loading-gap: 22px;

  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3;
  width: min(86vw, 380px);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-time-long);
  contain: layout;

  > .splash {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
    transition:
      opacity var(--transition-time),
      visibility 0s linear 0s;

    &[data-visible='false'] {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transition:
        opacity var(--transition-time),
        visibility 0s linear var(--transition-time);
    }

    > .splash-title {
      margin: 0;
      color: rgb(255 255 255 / 96%);
      font-size: clamp(28px, 6vw, 42px);
      font-weight: 700;
      line-height: 1.1;
      text-align: center;
      letter-spacing: 0.01em;
      text-shadow:
        0 2px 18px rgb(0 0 0 / 60%),
        0 0 32px rgb(255 255 255 / 10%);
    }

    > .splash-description {
      margin: 0;
      max-width: 70ch;
      color: rgb(255 255 255 / 80%);
      font-size: 15px;
      font-weight: 400;
      line-height: 1.45;
      text-align: center;
      text-shadow: 0 1px 12px rgb(0 0 0 / 60%);
    }

    > .start-button {
      margin-top: 8px;
      padding: 14px 40px;
      border: 1px solid rgb(255 255 255 / 38%);
      border-radius: 999px;
      background: rgb(255 255 255 / 8%);
      color: rgb(255 255 255 / 96%);
      font-size: 16px;
      font-weight: 600;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      cursor: pointer;
      backdrop-filter: blur(6px);
      box-shadow:
        0 0 24px rgb(255 255 255 / 14%),
        0 1px 6px rgb(0 0 0 / 28%);
      transition:
        opacity var(--transition-time),
        transform var(--transition-time),
        background var(--transition-time);

      &[disabled] {
        opacity: 0.5;
        cursor: progress;
      }

      &:not([disabled]):hover,
      &:not([disabled]):focus-visible {
        background: rgb(255 255 255 / 16%);
        transform: scale(1.04);
        outline: none;
      }

      &:not([disabled]):active {
        transform: scale(0.98);
      }
    }
  }

  > .loading-bar {
    position: absolute;
    top: calc(100% + var(--loading-gap));
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity var(--transition-time),
      visibility 0s linear var(--transition-time);

    &[data-visible='true'] {
      opacity: 1;
      visibility: visible;
      transition:
        opacity var(--transition-time),
        visibility 0s linear 0s;
    }

    > .loading-status {
      color: rgb(255 255 255 / 88%);
      font-size: 16px;
      font-weight: 400;
      line-height: 1.25;
      text-align: center;
      text-shadow: 0 1px 12px rgb(0 0 0 / 60%);
      letter-spacing: 0.01em;
      min-height: 1.25em;
    }

    > .loading-progress {
      --loading-progress: 0%;

      position: relative;
      width: 100%;
      height: 3px;
      overflow: hidden;
      border-radius: 999px;
      background: rgb(255 255 255 / 14%);
      box-shadow: 0 1px 6px rgb(0 0 0 / 28%);

      &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: var(--loading-progress);
        border-radius: inherit;
        background: linear-gradient(
          90deg,
          rgb(255 255 255 / 72%),
          rgb(255 255 255 / 96%)
        );
        box-shadow: 0 0 12px rgb(255 255 255 / 38%);
        transition: width var(--transition-time-long) ease-out;
      }
    }
  }
}

html > body.is-loading {
  .loading-indicator {
    opacity: 1;
  }

  .eraser-preview {
    visibility: hidden;
  }

  aside.control-dock {
    opacity: 0;
    visibility: hidden;
  }
}
